Drop pruning boards by region: a fix for the US seed, and a wrong one
`app companies prune`, `/api/prune` and the Sources disclosure switched off every board with no open role in a region. It existed because the first seed was 186 US boards; the European seed makes it moot, and it was wrong on its own terms: a board with no European role today (a company between openings, or a fetch that timed out) was switched off for good. A company that hires nowhere near should not be in the list, and a ranking's country gate handles the rest. `EUROPE` in models had no other reader and goes with it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
3aee48997c
commit
e602eb3388
12 files changed
+11
-233
No files matched your search
+1
-56
@@ -1,6 +1,5 @@
|
||||
/* The Company boards section of Sources: every company, its board, its open
|
||||
* roles, its affinity, following a new one, and pruning boards with nothing
|
||||
* open in a region.
|
||||
* roles, its affinity, and following a new one.
|
||||
*
|
||||
* The list is app.js's shared company list (`/api/companies`), already
|
||||
* joined with each company's board subscription — its id and whether it is
|
||||
@@ -174,58 +173,6 @@
|
||||
button.disabled = false;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------- prune
|
||||
|
||||
/** @type {object[]} the boards the last preview named. */
|
||||
let pruneBoards = [];
|
||||
|
||||
async function previewPrune(event) {
|
||||
event.preventDefault();
|
||||
const status = $("#prune-status");
|
||||
const list = $("#prune-list");
|
||||
const region = $("#p-region").value.trim();
|
||||
list.replaceChildren();
|
||||
$("#p-apply").disabled = true;
|
||||
$("#p-apply").textContent = "Switch off these boards";
|
||||
status.textContent = "Checking every board…";
|
||||
try {
|
||||
const result = await api(`/api/prune?region=${encodeURIComponent(region)}`);
|
||||
pruneBoards = result.boards;
|
||||
const roles = pruneBoards.reduce((sum, b) => sum + b.open_roles, 0);
|
||||
status.textContent = pruneBoards.length
|
||||
? `${count(pruneBoards.length, "board")} with no open role in ${region}, `
|
||||
+ `${count(roles, "open role")} between them:`
|
||||
: `Every board that is on has a role in ${region}.`;
|
||||
for (const board of pruneBoards) {
|
||||
const li = document.createElement("li");
|
||||
li.textContent = `${board.label} (${board.target}), ${count(board.open_roles, "open role")}`;
|
||||
list.appendChild(li);
|
||||
}
|
||||
$("#p-apply").disabled = pruneBoards.length === 0;
|
||||
$("#p-apply").textContent = `Switch off these ${count(pruneBoards.length, "board")}`;
|
||||
} catch (err) {
|
||||
status.textContent = "";
|
||||
}
|
||||
}
|
||||
|
||||
async function applyPrune() {
|
||||
const region = $("#p-region").value.trim();
|
||||
if (!window.confirm(`Switch off ${count(pruneBoards.length, "board")} and close their roles? `
|
||||
+ "Each can be switched back on in the list above.")) return;
|
||||
$("#p-apply").disabled = true;
|
||||
try {
|
||||
const result = await api("/api/prune", { method: "POST", body: { region } });
|
||||
$("#prune-status").textContent = `Switched off ${count(result.pruned, "board")}, `
|
||||
+ `closed ${count(result.roles_closed, "role")}. ${result.boards_left} boards are on.`;
|
||||
$("#prune-list").replaceChildren();
|
||||
$("#p-apply").textContent = "Switch off these boards";
|
||||
await loadCompanies(agentId());
|
||||
render();
|
||||
} catch (err) {
|
||||
$("#p-apply").disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------- init
|
||||
|
||||
async function switchAgent() {
|
||||
@@ -250,7 +197,5 @@
|
||||
$("#c-filter").addEventListener("change", render);
|
||||
$("#c-agent").addEventListener("change", switchAgent);
|
||||
$("#board-form").addEventListener("submit", addBoard);
|
||||
$("#prune-form").addEventListener("submit", previewPrune);
|
||||
$("#p-apply").addEventListener("click", applyPrune);
|
||||
});
|
||||
})();
|
||||
@@ -1,8 +1,7 @@
|
||||
/* The Job boards section of Sources: one query on one board per row, on
|
||||
* Jobindex or Adzuna. The UI says "job board" for what the API and the CLI
|
||||
* call a search (`/api/searches`, `app searches`); company boards and the
|
||||
* prune by region are companies.js's section, since a board is a company's
|
||||
* own, not a query's.
|
||||
* call a search (`/api/searches`, `app searches`); company boards are
|
||||
* companies.js's section, since a board is a company's own, not a query's.
|
||||
*
|
||||
* The list comes from `/api/sources`, and every action is a fetch through
|
||||
* `api()` from app.js, so a refusal (a query that finds nothing) is one
|
||||
|
||||
Reference in new issue
Block a user