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
+23
-1
@@ -763,6 +763,18 @@ JsonStrings = Annotated[list[str], BeforeValidator(lambda v: _json(v, "[]"))]
|
||||
|
||||
# ------------------------------------------------------------------ models
|
||||
|
||||
class RoleCopy(Model):
|
||||
"""One open copy of a kept role, as the reader lists it under "Also
|
||||
posted": where it is listed (`host`, the search provider or the board's
|
||||
ATS) and the link that opens it there."""
|
||||
|
||||
uid: str
|
||||
host: str = ""
|
||||
place: str = ""
|
||||
original_url: str = ""
|
||||
posted_at: str = ""
|
||||
|
||||
|
||||
class Role(Model):
|
||||
"""A row of `roles`: one posting on one board."""
|
||||
|
||||
@@ -819,6 +831,13 @@ class Role(Model):
|
||||
#: The open vocabulary `summarise` read off the posting, sorted. Not a
|
||||
#: column: loaded from `role_tags` alongside the row, see `Store.role`.
|
||||
tags: list[str] = []
|
||||
#: The uid of the kept role when this one is a copy of the same posting
|
||||
#: (`app.dupes`, `Store.rebuild_dupes`), else None. A copy is left out of
|
||||
#: the feed and the counts but still opens by uid.
|
||||
dup_of: str | None = None
|
||||
#: The open copies of this role, oldest first, when it is the kept one;
|
||||
#: empty otherwise. Not a column: filled by `Store.role`.
|
||||
copies: list[RoleCopy] = []
|
||||
|
||||
@computed_field # type: ignore[prop-decorator]
|
||||
@property
|
||||
@@ -895,7 +914,8 @@ class RoleRow(Model):
|
||||
derived as on `Role`. `original_url` is one short string, kept so the
|
||||
`o` key opens a selected row's posting without opening the reader.
|
||||
`seniority` is the title's level until extract reads the posting, ''
|
||||
when neither says."""
|
||||
when neither says. `copies` counts the open copies the feed hides behind
|
||||
this row."""
|
||||
|
||||
uid: str
|
||||
company_key: str = ""
|
||||
@@ -920,6 +940,8 @@ class RoleRow(Model):
|
||||
read_at: str | None = None
|
||||
tags: list[str] = []
|
||||
excerpt: str = ""
|
||||
#: How many open roles are copies of this one (`Role.copies`), 0 when none.
|
||||
copies: int = 0
|
||||
|
||||
@computed_field # type: ignore[prop-decorator]
|
||||
@property
|
||||
|
||||
Reference in new issue
Block a user