Regroup copies when a board or search is switched off, and fold the duplicates plan into the decisions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Opus 5.5 committed 2026-09-29 23:11:33 +02:00
1 parent e1c197b488
commit 82b7902eff
4 files changed
+34 -65

No files matched your search

+11 -3
View File
@@ -31,9 +31,13 @@ PROVIDERS = ("jobindex", "adzuna", "platsbanken")
def set_fetch(store: Store, sub_id: int, fetch: bool) -> tuple[Subscription, int]:
"""Switch one board or search on or off. Off closes its open roles and
returns how many; see the module docstring."""
returns how many; see the module docstring. A close regroups the copies
(`Store.rebuild_dupes`), so a copy of a role that closed here shows now
rather than at the next pull."""
sub = store.update_subscription(sub_id, subscribed=fetch, fetch=fetch, show=True)
closed = 0 if fetch else store.close_subscription(sub_id)
if closed:
store.rebuild_dupes()
return sub, closed
@@ -411,9 +415,13 @@ def save_search(config: Config, store: Store, provider: str, name: str,
def remove_search(store: Store, sub_id: int) -> tuple[Subscription, int]:
"""Stop running a search and hide it. Its open roles close; adding a search
of the same name again brings the row back."""
of the same name again brings the row back, and the copies regroup as in
`set_fetch`."""
sub = store.subscription(sub_id)
if sub is None or sub.source != "search":
raise KeyError(sub_id)
store.unsubscribe(sub_id)
return sub, store.close_subscription(sub_id)
closed = store.close_subscription(sub_id)
if closed:
store.rebuild_dupes()
return sub, closed