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
+20
-10
@@ -125,7 +125,7 @@ _EXCERPT_RAW = 240
|
||||
_COMPANY_FIELDS = ("name", "domain", "status", "careers_url", "notes", "ats", "country", "city",
|
||||
"ats_slug", "watch", "careers_opened_at", "hand_reason", "sector", "stage",
|
||||
"size_band", "founded", "last_funding", "last_funding_currency",
|
||||
"facts_source", "facts_at", "all_roles")
|
||||
"facts_source", "facts_at", "all_roles", "all_countries")
|
||||
|
||||
#: A company as the store serves it: the row and the asked-for agent's affinity.
|
||||
_COMPANY_SELECT = """SELECT c.*, COALESCE(ac.affinity, 0) AS affinity FROM companies c
|
||||
@@ -1938,9 +1938,16 @@ class Store:
|
||||
self._alias(conn, key, fields["name"])
|
||||
return self._company(key)
|
||||
|
||||
def set_all_countries(self, key: str, on: bool) -> Company:
|
||||
"""Switch a company's All countries override: its big boards are read
|
||||
with the agents' wide reach, Europe today, rather than their places,
|
||||
from the next pull (`app/jobs/reach.py`). Global, not per agent.
|
||||
Raises KeyError for an unknown company."""
|
||||
return self.update_company(key, all_countries=int(bool(on)))
|
||||
|
||||
def set_all_roles(self, key: str, on: bool) -> Company:
|
||||
"""Tag a company All roles, or untag it: its boards are read with the
|
||||
agents' wide reach, Europe today, from the next pull
|
||||
"""Switch a company's All roles override: its boards are read with no
|
||||
role-type narrowing, no fetch terms today, from the next pull
|
||||
(`app/jobs/reach.py`). Global, not per agent. Raises KeyError for an
|
||||
unknown company."""
|
||||
return self.update_company(key, all_roles=int(bool(on)))
|
||||
@@ -2001,10 +2008,11 @@ class Store:
|
||||
def merge_companies(self, keep: str, other: str) -> Company:
|
||||
"""Fold company `other` into `keep`, in one transaction: its roles and
|
||||
subscriptions move to `keep`, each agent's stance moves unless the
|
||||
agent has one on `keep` already, an All roles tag carries over, its
|
||||
aliases and its name become aliases of `keep`, and its row goes. Copies are not recomputed
|
||||
(`rebuild_dupes`). Raises KeyError for an unknown company and
|
||||
ValueError for merging one into itself."""
|
||||
agent has one on `keep` already, the All countries and All roles
|
||||
overrides carry over, its aliases and its name become aliases of
|
||||
`keep`, and its row goes. Copies are not recomputed (`rebuild_dupes`).
|
||||
Raises KeyError for an unknown company and ValueError for merging one
|
||||
into itself."""
|
||||
if keep == other:
|
||||
raise ValueError("a company cannot be merged into itself")
|
||||
with self.transaction() as conn:
|
||||
@@ -2025,9 +2033,11 @@ class Store:
|
||||
(keep, other))
|
||||
conn.execute("DELETE FROM company_aliases WHERE company_key=?", (other,))
|
||||
self._alias(conn, keep, rows[other])
|
||||
conn.execute("UPDATE companies SET all_roles = MAX(all_roles, "
|
||||
"(SELECT all_roles FROM companies WHERE key=?)) WHERE key=?",
|
||||
(other, keep))
|
||||
conn.execute("UPDATE companies SET "
|
||||
"all_roles = MAX(all_roles, (SELECT all_roles FROM companies WHERE key=?)), "
|
||||
"all_countries = MAX(all_countries, "
|
||||
"(SELECT all_countries FROM companies WHERE key=?)) WHERE key=?",
|
||||
(other, other, keep))
|
||||
conn.execute("DELETE FROM companies WHERE key=?", (other,))
|
||||
return self._company(keep)
|
||||
|
||||
|
||||
Reference in new issue
Block a user