Judge an employer known only from a search; the Companies list says "from job boards"
Store.set_affinity creates a minimal company row (key, and the name its roles give most often) for a key with roles and no row, so a Jobindex or Adzuna employer can be hidden or liked; the reader draws the control for any role with a company_key and reloads the company list after the first change. /api/companies derives from_search: no ats subscription (detached included) and no ats, careers_url or domain. companies.js labels it "from job boards" and keeps it out of "Not readable yet". Co-Authored-By: Claude Opus <noreply@anthropic.com>
This commit is contained in:
1 parent
91d15fcc7d
commit
b2c8c08f7f
6 files changed
+78
-15
No files matched your search
+15
-2
@@ -1067,11 +1067,24 @@ class Store:
|
||||
"""One agent's stance on a company: -1 hidden, 0 neutral, 1 liked, 2
|
||||
favourite. 0 deletes the row, since no row means neutral. Returns the
|
||||
company with this agent's affinity. Raises ValueError for another
|
||||
value and KeyError for an unknown company or agent."""
|
||||
value and KeyError for an unknown company or agent.
|
||||
|
||||
A key with roles and no company row, an employer known only from a
|
||||
search, gets a row here holding only its key and the name its roles
|
||||
give it, the most frequent one: nothing else can be judged without
|
||||
one. It has no board, `ats`, `careers_url` or `domain`, which is how
|
||||
the Companies list tells it from a followed company."""
|
||||
_check_affinity(affinity)
|
||||
with self.transaction() as conn:
|
||||
self._known(conn, "companies", "key", key)
|
||||
self._known(conn, "agents", "id", agent_id)
|
||||
if conn.execute("SELECT 1 FROM companies WHERE key=?", (key,)).fetchone() is None:
|
||||
named = conn.execute(
|
||||
"""SELECT company FROM roles WHERE company_key=? AND company<>''
|
||||
GROUP BY company ORDER BY count(*) DESC, max(last_seen) DESC
|
||||
LIMIT 1""", (key,)).fetchone()
|
||||
if named is None:
|
||||
raise KeyError(key)
|
||||
self._insert_company(conn, key, named[0], {})
|
||||
if affinity == 0:
|
||||
conn.execute("DELETE FROM agent_companies WHERE agent_id=? AND company_key=?",
|
||||
(agent_id, key))
|
||||
|
||||
Reference in new issue
Block a user