Say remote not asked on the Companies line, show a failing search on its row, forget a removed search's record, and mark a read that asked nothing as not closing
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ad47605fd
commit
a63eed2e56
10 files changed
+66
-36
No files matched your search
+19
-9
@@ -328,7 +328,7 @@ def site_facets(store: Store, subs: Iterable[Subscription]) -> dict[str, dict[st
|
||||
out: dict[str, dict[str, dict[str, str]]] = {}
|
||||
for sub in subs:
|
||||
module = readers.HOSTS.get(sub.target.partition(":")[0])
|
||||
if module is None or not _runner.declared(module) \
|
||||
if module is None \
|
||||
or "ids" not in (module.READS.filters.country, module.READS.filters.remote):
|
||||
continue
|
||||
try:
|
||||
@@ -399,8 +399,9 @@ def _site(module: Any, ask: readers.Ask, facets: Mapping[str, Mapping[str, str]]
|
||||
before any are kept), as `_runner.series` drops them: what is asked,
|
||||
then what the site does not know ("DK · SE not on this site · no remote
|
||||
option"), after `lead` and before `roles`; or, with nothing left to
|
||||
ask, "site lists none of DK, SE: nothing asked". "" when the site knows
|
||||
every value, or `lead` is "" and something is still asked."""
|
||||
ask, "site lists none of DK, SE: nothing asked, not closing", since the
|
||||
runner reads such a board as incomplete. "" when the site knows every
|
||||
value, or `lead` is "" and something is still asked."""
|
||||
if facets is None:
|
||||
return ""
|
||||
reads = module.READS.filters
|
||||
@@ -418,9 +419,9 @@ def _site(module: Any, ask: readers.Ask, facets: Mapping[str, Mapping[str, str]]
|
||||
remote = bool(ask.remote) and not no_remote
|
||||
if not (known or ask.places or remote):
|
||||
if not missing:
|
||||
return "site has no remote option: nothing asked"
|
||||
return "site has no remote option: nothing asked, not closing"
|
||||
named = _codes(missing) + (["remote"] if no_remote else [])
|
||||
return f"site lists none of {', '.join(named)}: nothing asked"
|
||||
return f"site lists none of {', '.join(named)}: nothing asked, not closing"
|
||||
if not lead:
|
||||
return ""
|
||||
words = [", ".join(_codes(known) + list(ask.places) + (["remote"] if remote else []))]
|
||||
@@ -452,7 +453,9 @@ def line(found: Plan, sub: Subscription) -> str:
|
||||
a host that filters by its own ids, the line names what the site does
|
||||
not know once the runner has asked it (`_site`): "follows agents: DK ·
|
||||
SE not on this site · no remote option · all roles", or "site lists
|
||||
none of DK, SE: nothing asked"."""
|
||||
none of DK, SE: nothing asked, not closing", or, on a host with no remote
|
||||
filter while the agents want remote, "follows agents: DK, SE · remote not
|
||||
asked on SmartRecruiters · all roles"."""
|
||||
module = readers.HOSTS.get(sub.target.partition(":")[0])
|
||||
if module is None:
|
||||
return ""
|
||||
@@ -465,12 +468,19 @@ def line(found: Plan, sub: Subscription) -> str:
|
||||
lead = {"agents": "follows agents", "override": "set here"}.get(why, "")
|
||||
if site := _site(module, ask, found.facets.get(sub.target), lead, roles):
|
||||
return site
|
||||
# The reach wants remote roles and the host cannot be asked for them:
|
||||
# the read leaves them out, and the settle keeps the ones it has
|
||||
# (`app.jobs.pull`), so the line says so rather than "DK, SE".
|
||||
unasked = (f" · remote not asked on {module.LABEL}"
|
||||
if module.READS.filters.remote == "none"
|
||||
and _runner.remote_wanted(module, sub.params, found.for_subscription(sub))
|
||||
else "")
|
||||
if why == "countries":
|
||||
named = found.wide_names or f"{len(found.wide.countries)} countries"
|
||||
return f"all countries ({named}) · {roles}"
|
||||
return f"all countries ({named}){unasked} · {roles}"
|
||||
if why == "override":
|
||||
return f"set here: {_places(ask)} · {roles}"
|
||||
return f"follows agents: {_places(ask)} · {roles}"
|
||||
return f"set here: {_places(ask)}{unasked} · {roles}"
|
||||
return f"follows agents: {_places(ask)}{unasked} · {roles}"
|
||||
if ask.terms:
|
||||
if given.everywhere:
|
||||
return f"all countries (everywhere) · {roles}"
|
||||
|
||||
+4
-1
@@ -20,7 +20,7 @@ from urllib.parse import urlsplit
|
||||
from app.config import Config
|
||||
from app.models import HAND_REASONS, Company, Subscription, company_key
|
||||
from app.storage import Store
|
||||
from app.jobs.pull import FAILING, search_target
|
||||
from app.jobs.pull import FAILING, SEARCH_FAILING, search_target
|
||||
from plugins import readers
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -436,6 +436,9 @@ def remove_search(store: Store, sub_id: int) -> tuple[Subscription, int]:
|
||||
if sub is None or sub.source != "search":
|
||||
raise KeyError(sub_id)
|
||||
store.unsubscribe(sub_id)
|
||||
# A record of the search failing would otherwise outlive it, as a
|
||||
# board's would (`_forget_failing`).
|
||||
store.state.pop(SEARCH_FAILING + sub.target, None)
|
||||
closed = store.close_subscription(sub_id)
|
||||
if closed:
|
||||
store.rebuild_dupes()
|
||||
|
||||
Reference in new issue
Block a user