Treat remote_from as remote reach and suggest the remote tokens with counts
/api/suggest/places offers "Remote" (remote:any) first for "remote", counted in the scope of the agent asked for or the default agent, then the countries, then "Remote · <place>". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f2b1ff72a
commit
d0be7c1162
2 files changed
+26
-10
No files matched your search
+9
-5
@@ -6,17 +6,19 @@ on. Computed once per pull (`plan`) and handed to each board's batch as the
|
||||
|
||||
- **Base reach**: the union of the enabled agents' `any` gates on country,
|
||||
place (a town or region, mapped to its country through the gazetteer) and
|
||||
remote. An agent whose `any` group is empty, or holds any other member (a
|
||||
function, a remote value other than `remote`, a place the gazetteer does
|
||||
not know), can take a role from anywhere, so the base reach is then
|
||||
everywhere.
|
||||
remote; a `remote_from` gate is remote. An agent whose `any` group is
|
||||
empty, or holds any other member (a function, a remote value other than
|
||||
`remote`, a place the gazetteer does not know), can take a role from
|
||||
anywhere, so the base reach is then everywhere.
|
||||
- **Wide reach, for the companies set to All countries**
|
||||
(`companies.all_countries`, global): the union over the enabled agents of
|
||||
their `require` reach, the intersection of each one's `require` gates on
|
||||
country and place, Europe today, expanded to its countries through the
|
||||
gazetteer, and the base reach, so the override never reads less than the
|
||||
board would without it. An agent with no `require` gate on place makes it
|
||||
everywhere. A role in Freiburg may be open to remote, or worth asking the
|
||||
everywhere. A `require` gate on remote or `remote_from` next to one on
|
||||
country adds nothing to it, so remote never widens it past the countries.
|
||||
A role in Freiburg may be open to remote, or worth asking the
|
||||
company about for Denmark. Favourite (affinity 2) is scoring only, where
|
||||
it skips the `any` gates; it does not widen what is fetched.
|
||||
- **Board override**: a board whose subscription `params` name a country, a
|
||||
@@ -145,6 +147,8 @@ def gate_reach(gate: Gate, gaz: places.Gazetteer) -> Reach:
|
||||
everywhere for a gate that says nothing of place or names one the
|
||||
gazetteer does not know."""
|
||||
values = [str(v).strip() for v in gate.values if str(v).strip()]
|
||||
if gate.field == "remote_from":
|
||||
return Reach(remote=True)
|
||||
if gate.field == "remote":
|
||||
return Reach(remote=True) if values and all(v.lower() == "remote" for v in values) \
|
||||
else EVERYWHERE
|
||||
|
||||
+17
-5
@@ -287,7 +287,7 @@ class PlaceSuggestion(BaseModel):
|
||||
|
||||
token: str
|
||||
label: str
|
||||
kind: Literal["country", "region", "place"]
|
||||
kind: Literal["country", "region", "place", "remote"]
|
||||
count: int
|
||||
|
||||
|
||||
@@ -331,13 +331,25 @@ def suggest_companies(
|
||||
def suggest_places(
|
||||
store: StoreDep,
|
||||
q: str = "",
|
||||
agent: int | None = None,
|
||||
limit: Annotated[int, Query(ge=1, le=50)] = 12,
|
||||
) -> list[PlaceSuggestion]:
|
||||
"""Place tokens for the text typed so far: countries, then regions, then
|
||||
towns, each by open roles (`places.suggest`, over every open role's place
|
||||
line). An empty `q` suggests nothing."""
|
||||
"""Place tokens for the text typed so far: "Remote" (`remote:any`) when
|
||||
`q` starts "remote", countries, the remote tokens ("Remote · Denmark"),
|
||||
regions, then towns, each by open roles (`places.suggest`, over every
|
||||
open role's place line and every open remote role's area). The count of
|
||||
`remote:any` is the remote roles in the scope of `agent`, the default
|
||||
agent when absent, as the feed counts them. An empty `q` suggests
|
||||
nothing."""
|
||||
if not places.fold(q):
|
||||
return []
|
||||
viewer = _agent_id(store, agent)
|
||||
return [PlaceSuggestion(token=s.token, label=s.label, kind=s.kind, count=s.count)
|
||||
for s in places.suggest(q, store.open_places(), limit)]
|
||||
for s in places.suggest(
|
||||
q, store.open_places(), limit, remote=store.open_remote_areas(),
|
||||
gaz=store.gazetteer(),
|
||||
remote_any=lambda: store.count_roles(places=["remote:any"], agent=viewer,
|
||||
by_score=False))]
|
||||
|
||||
|
||||
@router.get("/places/labels")
|
||||
|
||||
Reference in new issue
Block a user