From 6451f503f29b15876ed9441924a3e338f60cb33f Mon Sep 17 00:00:00 2001 From: Wolf Date: Wed, 30 Sep 2026 16:00:45 +0200 Subject: [PATCH] Show and filter the limits on the Companies list, list the traits on Sources Co-Authored-By: Claude Fable 5.1 --- app/static/companies.js | 33 ++++++++++++++++++++++++++++- app/static/sources.js | 22 ++++++++++++++++--- app/templates/settings/sources.html | 21 ++++++++++++++++++ 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/app/static/companies.js b/app/static/companies.js index 19ba470..32edb13 100644 --- a/app/static/companies.js +++ b/app/static/companies.js @@ -33,6 +33,12 @@ * 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. + * + * After the size stand the board's limits, words for what its read cannot do + * ("read incomplete · no pay · without text: 12", `limits` from + * app/jobs/limits.py), and the Limits group of the filter picks the companies + * that have one. "N on this board" beside the open roles says the company + * has roles from a search too. */ (function () { "use strict"; @@ -107,6 +113,14 @@ return button; } + /** What a limit word means, from the title of its option in the filter + select ("without text: 12" is looked up as "without text"). */ + function limitMeaning(word) { + const phrase = word.split(":")[0]; + const option = [...$("#c-filter").options].find((o) => o.value === phrase); + return option && option.title ? `${word}: ${option.title}` : ""; + } + function subLine(company, rerender) { const sub = document.createElement("span"); sub.className = "sub"; @@ -143,11 +157,26 @@ sub.appendChild(link); } sub.append(` · ${count(company.open_roles, "open role")}`); + // open_roles also counts what a search listed; say so when the board's own differ. + if (company.board_open != null && company.board_open !== company.open_roles) { + sub.append(` (${company.board_open} on this board)`); + } 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}` : ""}`); } + const words = (company.limits || []).filter((w) => w !== "failing"); + if (words.length) { + // What limits the read (app/jobs/limits.py). The failing word is the + // line after this one; only the filter needs it as a word. + const limits = document.createElement("span"); + limits.className = "limits"; + limits.append(words.join(" · ")); + limits.title = words.map(limitMeaning).filter(Boolean).join("\n"); + sub.append(" · "); + sub.appendChild(limits); + } if (company.failing_since) { // The board has failed on every pull since then; after 21 days its // roles close. @@ -369,7 +398,9 @@ case "on": return company.on === true; case "off": return company.on === false; case "unreadable": return company.subscription_id == null && !company.from_search; - default: return true; + case "": return true; + // A limit (app/jobs/limits.py): the word up to its colon, which may carry a number. + default: return (company.limits || []).some((word) => word.startsWith(filter)); } } diff --git a/app/static/sources.js b/app/static/sources.js index 42f1b63..39feee6 100644 --- a/app/static/sources.js +++ b/app/static/sources.js @@ -18,8 +18,9 @@ * * Under the Follow form of Company boards, a fold lists what each reader * declares (`/api/readers`): how its list arrives, where the text is, what - * it filters at the source, how it states places, and the robots.txt - * decision taken when it was built. + * it filters at the source, how it states places, how it knows a read is + * complete, its page size and ceiling, which fields its rows state, and the + * robots.txt decision taken when it was built. * * The Unmapped section lists what prep could not place, most roles first: * the place texts no place resolves (`/api/prep/unlinked`), with the @@ -297,6 +298,20 @@ return shown.length ? shown.join(", ") : "none"; } + /** What the reader declares of its limits, short: how completeness is known, + the page size and ceiling, a teaser beside the detail text, an empty list + that may be an unknown slug, and what its rows state. */ + function limits(reader) { + const out = [`complete ${reader.complete}`]; + if (reader.page_size) out.push(`${reader.page_size} a page`); + if (reader.ceiling) out.push(`ceiling ${reader.ceiling}`); + if (reader.teaser) out.push("teaser in the list"); + if (reader.empty === "suspect") out.push("empty may be an unknown slug"); + const fields = Object.entries(reader.fields || {}).map(([name, how]) => `${name} ${how}`); + if (fields.length) out.push(`states ${fields.join(", ")}`); + return out; + } + function renderReaders(readers) { const fold = document.createElement("details"); fold.className = "prune"; @@ -319,7 +334,8 @@ const sub = document.createElement("span"); sub.className = "sub"; sub.textContent = [`list ${reader.listing}`, `text ${reader.text}`, - `filters ${filters(reader)}`, `places ${reader.places}`, reader.robots].join(" · "); + `filters ${filters(reader)}`, `places ${reader.places}`, ...limits(reader), + reader.robots].join(" · "); row.append(name, sub); list.appendChild(row); } diff --git a/app/templates/settings/sources.html b/app/templates/settings/sources.html index a2f9c5a..14412ab 100644 --- a/app/templates/settings/sources.html +++ b/app/templates/settings/sources.html @@ -111,6 +111,27 @@ + {# The phrases of app/jobs/limits.py `WORDS`, with their meanings; a test + compares the two. companies.js shows the meaning on the row. #} + + + + + + + + + + + + + + + + + + + {# Liked and hidden are per search agent: this picks whose the list shows and whose the buttons set. companies.js fills it from /api/agents. #}