Merge branch 'main' into wp1-byhand-api
# Conflicts: # app/models.py # app/storage/schema.py # app/storage/store.py # app/web/api.py # tests/test_storage.py # tests/test_web.py
This commit is contained in:
commit
1a2689e08d
17 files changed
+565
-109
No files matched your search
+11
-11
@@ -94,7 +94,7 @@ _EXCERPT_SOURCE = "COALESCE(NULLIF(roles.summary, ''), roles.description)"
|
||||
_EXCERPT_RAW = 240
|
||||
|
||||
_COMPANY_FIELDS = ("name", "domain", "status", "careers_url", "notes", "ats", "country", "city",
|
||||
"ats_slug", "hand_reason", "checked_at")
|
||||
"ats_slug", "watch", "careers_opened_at", "hand_reason")
|
||||
|
||||
#: 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
|
||||
@@ -496,10 +496,11 @@ class Store:
|
||||
"""Newest first by `posted_at`. `company` and `place` are
|
||||
case-insensitive substrings of the columns a board wrote — not the
|
||||
key, so a search does not have to know the exact slug a company folds
|
||||
to. `q` is matched word by word against `title`; a role must match
|
||||
every word. `function` and `remote` match a gate column exactly.
|
||||
`days` keeps only roles posted within that many days of now. `pay`
|
||||
(a key of `PAY`) filters on `salary_state`.
|
||||
to. `q` is matched word by word against `title` and `company`; a
|
||||
role must match every word in one or the other. `function` and
|
||||
`remote` match a gate column exactly. `days` keeps only roles posted
|
||||
within that many days of now. `pay` (a key of `PAY`) filters on
|
||||
`salary_state`.
|
||||
|
||||
`agent` says whose votes, hidden companies and scores are meant. Each
|
||||
row carries that agent's `vote` and `voted_at`; `judged` (a key of
|
||||
@@ -653,8 +654,8 @@ class Store:
|
||||
where.append("posted_at >= ?")
|
||||
params.append(_iso(self.clock() - timedelta(days=days)))
|
||||
for word in (q or "").split():
|
||||
where.append("title LIKE ? ESCAPE '\\'")
|
||||
params.append(_like(word))
|
||||
where.append("(title LIKE ? ESCAPE '\\' OR company LIKE ? ESCAPE '\\')")
|
||||
params += [_like(word)] * 2
|
||||
if judged:
|
||||
if judged not in JUDGED:
|
||||
raise ValueError(f"judged is {', '.join(JUDGED)}, not {judged!r}")
|
||||
@@ -1162,8 +1163,8 @@ class Store:
|
||||
def add_company(self, name: str, *, key: str = "", domain: str = "",
|
||||
status: str = "researching", careers_url: str = "",
|
||||
notes: str = "", ats: str = "", country: str = "",
|
||||
city: str = "", ats_slug: str = "", hand_reason: str = "",
|
||||
checked_at: str = "") -> Company:
|
||||
city: str = "", ats_slug: str = "",
|
||||
hand_reason: str = "") -> Company:
|
||||
"""Raises ValueError on a key already taken or a `hand_reason` outside
|
||||
`HAND_REASONS`."""
|
||||
name = name.strip()
|
||||
@@ -1176,8 +1177,7 @@ class Store:
|
||||
self._insert_company(conn, key, name, {
|
||||
"domain": domain, "status": status, "careers_url": careers_url,
|
||||
"notes": notes, "ats": ats, "country": country, "city": city,
|
||||
"ats_slug": ats_slug, "hand_reason": hand_reason,
|
||||
"checked_at": checked_at})
|
||||
"ats_slug": ats_slug, "hand_reason": hand_reason})
|
||||
except sqlite3.IntegrityError as exc:
|
||||
raise ValueError(f"company {key!r} already exists") from exc
|
||||
return self._company(key)
|
||||
|
||||
Reference in new issue
Block a user