Store copies of one posting as roles.dup_of and leave them out of the feed, the counts and the model stages
Migration 18 adds roles.dup_of with a partial index and runs the first rebuild. Store.rebuild_dupes feeds app.dupes.assign the open roles of every (company_key, title_key) with more than one, rewrites dup_of where it changed, clears it on closed roles, and hands read_at and votes to a changed group's kept role. The pull's settle and `app dupes` run it. RoleRow.copies counts a row's open copies; Role.copies lists them and Role.dup_of names a copy's kept role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55e353e764
commit
545c932f7b
10 files changed
+490
-41
No files matched your search
+7
-2
@@ -133,7 +133,9 @@ def role_facets(store: StoreDep, filters: FeedFilters) -> Facets:
|
||||
def get_role(uid: str, store: StoreDep, agent: int | None = None) -> ScoredRole:
|
||||
"""One role, open or closed, for the read page, with `agent`'s vote and
|
||||
score, and the prompt that gave its fit (the default agent's when absent;
|
||||
None when there is no agent)."""
|
||||
None when there is no agent). `copies` lists the open copies of a kept
|
||||
role (`RoleCopy`, for "Also posted"); a copy itself opens too, with
|
||||
`dup_of` naming its kept role."""
|
||||
role = store.role(uid, _agent_id(store, agent))
|
||||
if role is None:
|
||||
raise HTTPException(404, f"no such role: {uid}")
|
||||
@@ -226,7 +228,10 @@ def list_roles(
|
||||
`region:skane`, `place:malmo`, matched on whole folded words) and
|
||||
`seniority` (repeated levels), each several values joined by OR. A role
|
||||
with no level passes the seniority filter unless `seniority_unknown` is
|
||||
false. The parameters are read by `_feed_filters`."""
|
||||
false. The parameters are read by `_feed_filters`.
|
||||
|
||||
A copy of another role (`Store.rebuild_dupes`) is never a row; its kept
|
||||
role's `copies` says how many it stands for."""
|
||||
return RolesPage(items=store.roles_page(limit=limit, offset=offset, **filters),
|
||||
total=store.count_roles(**filters))
|
||||
|
||||
|
||||
Reference in new issue
Block a user