Merge board size set once, Recheck, and the Companies line naming what a site does not know (wp-a-size)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-30 13:45:27 +02:00
commit 8c66aeb445
11 files changed
+786 -70

No files matched your search

+48
View File
@@ -28,6 +28,11 @@
* posted to `/api/sources/{id}/reach`. The wide reach (Europe) and no role
* narrowing are the company's two overrides instead, and the board's own
* countries win over All countries.
*
* Beside that line stands the board's size, set when it was added and
* changed only by a Recheck ("999 roles · checked 30 Sep"). Recheck, beside
* Change, sizes the board again (`/api/sources/{id}/size`) and queues a
* pull, since the size decides whether the board is filtered.
*/
(function () {
"use strict";
@@ -67,6 +72,41 @@
// ---------------------------------------------------------------- the list
/** "30 Sep", or "30 Sep 2025" when it is not this year. A day alone
("2026-09-30") is read as local midnight, not UTC's. */
function checkedOn(iso) {
const text = String(iso || "");
const at = new Date(text.length === 10 ? `${text}T00:00` : text);
if (Number.isNaN(at.getTime())) return "";
const options = { day: "numeric", month: "short" };
if (at.getFullYear() !== new Date().getFullYear()) options.year = "numeric";
return at.toLocaleDateString("en-GB", options);
}
/** The row's Recheck: size the board again, which may change what it is
asked for, and read it with the pull that follows. */
function recheckButton(company, rerender) {
const button = document.createElement("button");
button.type = "button";
button.className = "linky";
button.textContent = "Recheck";
button.title = "Count the board's roles again";
button.addEventListener("click", async () => {
button.disabled = true;
try {
const result = await api(`/api/sources/${company.subscription_id}/size`,
{ method: "POST" });
window.toast.info(`${company.name}: ${count(result.size, "role")}, `
+ `reads ${result.reach}. Reading now, or with the pull right after.`);
await loadCompanies(agentId());
rerender();
} catch (err) {
button.disabled = false;
}
});
return button;
}
function subLine(company, rerender) {
const sub = document.createElement("span");
sub.className = "sub";
@@ -104,6 +144,10 @@
}
sub.append(` · ${count(company.open_roles, "open role")}`);
if (company.reach) sub.append(` · reads ${company.reach}`);
if (company.size != null) {
const checked = checkedOn(company.size_checked);
sub.append(` · ${count(company.size, "role")}${checked ? ` · checked ${checked}` : ""}`);
}
if (company.failing_since) {
// The board has failed on every pull since then; after 21 days its
// roles close.
@@ -115,6 +159,10 @@
sub.appendChild(failing);
}
sub.append(" ");
if (company.subscription_id != null) {
sub.appendChild(recheckButton(company, rerender));
sub.append(" ");
}
const edit = document.createElement("button");
edit.type = "button";
edit.className = "linky";