Keep a board's stated pay as salary_text, even when it does not normalise

Every ats parser now writes one human-readable pay line whether or not it
converts to yearly salary_min/salary_max/currency: hourly and daily rates,
Greenhouse's several pay zones, and a range with no currency all survive as
text instead of being dropped outright. Stored in roles.salary_text
(migration 12), replaced whole on every pull like title, so a board that
stops stating pay clears it rather than leaving a stale line. salary_state
is derived, not stored ('normalised', 'stated', or ''), and is what the
feed's new Pay filter and badge read; gates and scoring are unchanged, still
reading only the normalised columns.

Co-Authored-By: Claude Sonnet <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Sonnet committed 2026-09-29 15:08:45 +02:00
1 parent 706b127bc0
commit fa4e1a657f
18 files changed
+528 -57

No files matched your search

+44 -10
View File
@@ -84,7 +84,7 @@
function blankFilter() {
return {
sort: "score", agent: null, period: "all", tags: new Set(), showRead: true,
company: "", place: "", function: "", remote: "", judged: "",
company: "", place: "", function: "", remote: "", judged: "", pay: "",
showMuted: false, gated: false,
};
}
@@ -131,7 +131,7 @@
const p = new URLSearchParams();
if (state.q) p.set("q", state.q);
for (const key of ["company", "place"]) if (f[key].trim()) p.set(key, f[key].trim());
for (const key of ["function", "remote", "judged"]) if (f[key]) p.set(key, f[key]);
for (const key of ["function", "remote", "judged", "pay"]) if (f[key]) p.set(key, f[key]);
const days = PERIODS[f.period].days;
if (days) p.set("days", String(days));
if (f.showMuted) p.set("show_muted", "true");
@@ -154,7 +154,7 @@
const q = new URLSearchParams(location.search);
const f = state.filter;
state.q = q.get("q") || "";
for (const key of ["company", "place", "function", "remote", "judged"]) {
for (const key of ["company", "place", "function", "remote", "judged", "pay"]) {
f[key] = q.get(key) || "";
}
f.period = PERIOD_OF_DAYS[q.get("days")] || "all";
@@ -165,7 +165,8 @@
if (q.get("sort") === "time") f.sort = "time";
// Checked against the enabled agents once they are in (`chooseAgent`).
if (q.get("agent")) f.agent = Number(q.get("agent"));
if (f.company || f.place || f.function || f.remote || f.judged || f.showMuted || f.gated) {
if (f.company || f.place || f.function || f.remote || f.judged || f.pay
|| f.showMuted || f.gated) {
$("#f-more").open = true;
}
}
@@ -389,10 +390,11 @@
setValue("f-place", f.place);
setValue("f-function", f.function);
setValue("f-remote", f.remote);
setValue("f-pay", f.pay);
setValue("f-judged", f.judged);
setValue("f-show-muted", f.showMuted);
setValue("f-gated", f.gated);
const more = [f.company.trim(), f.place.trim(), f.function, f.remote, f.judged,
const more = [f.company.trim(), f.place.trim(), f.function, f.remote, f.pay, f.judged,
f.showMuted, ranked && f.gated].filter(Boolean).length;
$("#f-active").textContent = more ? ` · ${more}` : "";
@@ -435,7 +437,7 @@
function renderActive() {
const f = state.filter;
const on = [!f.showRead, f.period !== "all", f.company.trim(), f.place.trim(),
f.function, f.remote, f.judged, f.showMuted, sortShown() === "score" && f.gated]
f.function, f.remote, f.pay, f.judged, f.showMuted, sortShown() === "score" && f.gated]
.filter(Boolean).length + f.tags.size;
const count = on === 1 ? "1 filter" : `${on} filters`;
$(".rail-toggle-label").textContent = on ? count : "Menu";
@@ -490,9 +492,20 @@
aria-pressed="${state.filter.tags.has(tag)}">${esc(tag)}</button>`).join("");
}
/** The feed row's small pay badge: the range for 'normalised', "pay
stated" for 'stated', nothing for '' — `role.salary_state`, computed by
the API from `salary_min`/`salary_max`/`salary_text` (app/models.py). */
function payBadge(role) {
if (role.salary_state === "normalised") return salary(role);
if (role.salary_state === "stated") return "pay stated";
return "";
}
function badges(role, { seniority = false } = {}) {
const words = [role.remote, role.function, seniority ? role.seniority : ""].filter(Boolean);
const pay = payBadge(role);
return (role.closed_at ? `<span class="badge closed">closed</span>` : "")
+ (pay ? `<span class="badge">${esc(pay)}</span>` : "")
+ words.map((w) => `<span class="badge">${esc(w)}</span>`).join("");
}
@@ -575,7 +588,7 @@
if (!empty.hidden) {
const f = state.filter;
const filtered = state.q || f.tags.size || f.period !== "all" || !f.showRead
|| f.company.trim() || f.place.trim() || f.function || f.remote || f.judged;
|| f.company.trim() || f.place.trim() || f.function || f.remote || f.pay || f.judged;
empty.innerHTML = filtered
? `<h2>Nothing matches</h2>
<p>No open role fits these filters.
@@ -701,6 +714,25 @@
return "";
}
/* What the reader shows below the title for pay, or null when the role
states none: 'normalised' shows the range from the normalised columns,
plus the board's own text underneath when it says more than the range
does — a period, several zones — spotted by " per " or ";" in it, which
every conforming `salary_text` carries and the plain range never does
(`plugins.ats`'s `_pay_line`); 'stated' shows the text itself, with a
note that it was not normalised. */
function payDisplay(r) {
if (r.salary_state === "normalised") {
const range = salary(r);
const text = r.salary_text || "";
return { range, detail: /(;| per )/.test(text) && text !== range ? text : "", note: "" };
}
if (r.salary_state === "stated") {
return { range: r.salary_text, detail: "", note: "as stated, not normalised" };
}
return null;
}
function host(url) {
try { return new URL(url).host.replace(/^www\./, ""); } catch (e) { return ""; }
}
@@ -740,7 +772,7 @@
? `<p class="reader-note">Loading…</p>`
: text ? paragraphs(text)
: `<p class="reader-note">The board gave no description for this one.</p>`;
const pay = salary(r);
const pay = payDisplay(r);
const waiting = state.summarising === state.readingUid;
const teaser = r.uid && !r.article_text && out && (r.description || "").length < TEASER;
@@ -763,7 +795,9 @@
${tagChips(r.tags)}
</div>
<h1>${esc(r.title || "")}</h1>
${pay ? `<p class="reader-salary">${esc(pay)}</p>` : ""}
${pay ? `<p class="reader-salary">${esc(pay.range)}</p>
${pay.detail ? `<p class="muted small">${esc(pay.detail)}</p>` : ""}
${pay.note ? `<p class="muted small">${esc(pay.note)}</p>` : ""}` : ""}
${r.summary ? `<section class="reader-summary">
<h2 class="reader-label">Summary</h2><p>${esc(r.summary)}</p></section>` : ""}
<div class="reader-tools">
@@ -1030,7 +1064,7 @@
for (const key of ["company", "place"]) {
$(`#f-${key}`).addEventListener("input", (e) => { state.filter[key] = e.target.value; typed(); });
}
for (const key of ["function", "remote", "judged"]) {
for (const key of ["function", "remote", "pay", "judged"]) {
$(`#f-${key}`).addEventListener("change", (e) => setFilter({ [key]: e.target.value }));
}
$("#f-show-muted").addEventListener("change",