Split the All tag into two company overrides: All countries and All roles (WP L)
Fetching has two filters, and a company now overrides each on its own.
All countries (companies.all_countries) is the old All roles tag: its big
boards are read with the agents' wide reach. All roles (companies.all_roles,
new meaning) drops the agents' fetch terms and any later role filter.
- Migration 24 copies the old tag to all_countries and keeps all_roles for
those companies, and moves a board's {"terms": false} to its company.
- The runner no longer reads {"terms": false}; the plan leaves the terms out
for a company set to All roles.
- POST /api/companies/{key}/all-countries and /all-roles, each queueing a
pull when turned on; CompanyOut carries both.
- Two toggles replace All on the Companies row, the reader and the Roles
strip; the reach line states countries and role types in plain words;
the filter select gets both options.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
795ca3628c
commit
e52857dea5
23 files changed
+602
-215
No files matched your search
+50
-4
@@ -195,9 +195,11 @@ CREATE TABLE IF NOT EXISTS role_tags (
|
||||
-- worth checking by hand, 0 not; careers_opened_at when its careers page was
|
||||
-- last opened from there, which is also when a person last looked at it.
|
||||
-- hand_reason is why a person reads the careers page (models.HAND_REASONS),
|
||||
-- '' when nobody has to. all_roles 1 reads every board of the company with
|
||||
-- the agents' wide reach, Europe today (app/jobs/reach.py); global, since
|
||||
-- fetching is shared.
|
||||
-- '' when nobody has to. The two fetch overrides, global since fetching is
|
||||
-- shared (app/jobs/reach.py): all_countries 1 reads every big board of the
|
||||
-- company with the agents' wide reach, Europe today, rather than their
|
||||
-- places; all_roles 1 reads them with no role-type narrowing, no fetch terms
|
||||
-- today. Until migration 24, all_roles meant what all_countries means now.
|
||||
CREATE TABLE IF NOT EXISTS companies (
|
||||
key TEXT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
@@ -222,7 +224,8 @@ CREATE TABLE IF NOT EXISTS companies (
|
||||
last_funding_currency TEXT NOT NULL DEFAULT '',
|
||||
facts_source TEXT NOT NULL DEFAULT '',
|
||||
facts_at TEXT NOT NULL DEFAULT '',
|
||||
all_roles INTEGER NOT NULL DEFAULT 0
|
||||
all_roles INTEGER NOT NULL DEFAULT 0,
|
||||
all_countries INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
|
||||
-- Every folded spelling of a company (models.company_fold): orsted is Ørsted
|
||||
@@ -604,6 +607,10 @@ ALTER TABLE companies ADD COLUMN hand_reason TEXT NOT NULL DEFAULT '';
|
||||
# A Python step: it adds the column only where it is missing.
|
||||
(23, "agents.fetch_terms: words that narrow what big boards read with the wide reach "
|
||||
"send", lambda conn: _add_fetch_terms(conn)),
|
||||
# A Python step: params is JSON and the company is found by company_key.
|
||||
(24, "companies.all_countries takes over the All roles tag, and companies.all_roles "
|
||||
"means no role narrowing; a board's {\"terms\": false} becomes its company's "
|
||||
"all_roles", lambda conn: _split_all_roles(conn)),
|
||||
)
|
||||
|
||||
#: What a file created from `SCHEMA` today is already at.
|
||||
@@ -879,6 +886,45 @@ def _add_all_roles(conn: sqlite3.Connection) -> None:
|
||||
"to tag; it reads the agents' reach now", target, key)
|
||||
|
||||
|
||||
def _split_all_roles(conn: sqlite3.Connection) -> None:
|
||||
"""Migration 24's step. Fetching has two filters, countries and role
|
||||
types, and each gets its own company override. `all_countries` is the
|
||||
old All roles tag, the wide reach, copied from `all_roles` when the
|
||||
column is added. `all_roles` keeps its column and now means no role-type
|
||||
narrowing: a company that had the tag keeps it too, since the tag was
|
||||
given to the favourites whose every role the owner wanted. A board whose
|
||||
`params` hold `{"terms": false}` gives its company `all_roles`, and the
|
||||
param goes. Runs twice without harm: the copy happens only with the new
|
||||
column."""
|
||||
columns = {r[1] for r in conn.execute("PRAGMA table_info(companies)")}
|
||||
if "all_countries" not in columns:
|
||||
conn.execute("ALTER TABLE companies ADD COLUMN all_countries INTEGER NOT NULL DEFAULT 0")
|
||||
copied = conn.execute("UPDATE companies SET all_countries=1 WHERE all_roles=1").rowcount
|
||||
log.info("migration 24: %d companies tagged All roles are All countries and All roles",
|
||||
copied)
|
||||
moved = 0
|
||||
for sub_id, target, company, label, raw in conn.execute(
|
||||
"SELECT id, target, company, label, params FROM subscriptions "
|
||||
"WHERE source = 'ats'").fetchall():
|
||||
try:
|
||||
params = json.loads(raw or "{}")
|
||||
except ValueError:
|
||||
continue
|
||||
if not isinstance(params, dict) or "terms" not in params:
|
||||
continue
|
||||
off = params.pop("terms") is False
|
||||
conn.execute("UPDATE subscriptions SET params=? WHERE id=?", (json.dumps(params), sub_id))
|
||||
key = company_key(company or label)
|
||||
if not off:
|
||||
continue
|
||||
if conn.execute("UPDATE companies SET all_roles=1 WHERE key=?", (key,)).rowcount:
|
||||
moved += 1
|
||||
else:
|
||||
log.warning("migration 24: %s read without terms, but %r has no company row "
|
||||
"to mark All roles; it takes the agents' terms now", target, key)
|
||||
log.info("migration 24: %d boards' {\"terms\": false} became All roles", moved)
|
||||
|
||||
|
||||
_V22_COLUMNS = ("seniority_host", "employment_host", "remote_host", "country_host", "employment")
|
||||
|
||||
_V22 = """
|
||||
|
||||
Reference in new issue
Block a user