fix(discover): hide stale singles + replace album set on re-derive
- Client filters the row's album thumbnails to full albums only (hides singles/EPs left over from pre-albums-only sweeps). - Worker: re-deriving an artist deletes its pending album suggestions that are no longer picks (stale singles / now-owned), keeping wanted/dismissed rows, so the suggestion set self-cleans instead of accumulating. worker 246, web 189 tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -217,6 +217,16 @@ def _derive_albums(conn: psycopg.Connection, browser: MbBrowser, surfaced: list[
|
||||
if popular is not None:
|
||||
reasons[popular] = "newest,popular" if reasons.get(popular) == "newest" else "popular"
|
||||
|
||||
# Re-deriving replaces this artist's album set: drop any pending album suggestion of
|
||||
# theirs that is no longer a pick (stale singles/EPs from older sweeps, or an album now
|
||||
# owned), keeping wanted/dismissed rows untouched. Then upsert the current picks.
|
||||
with conn.cursor() as cur:
|
||||
cur.execute(
|
||||
"DELETE FROM \"DiscoverySuggestion\" WHERE kind = 'album' AND status = 'pending' "
|
||||
'AND "artistMbid" = %s AND NOT ("rgMbid" = ANY(%s))',
|
||||
(artist["mbid"], list(reasons.keys())),
|
||||
)
|
||||
|
||||
for rg in core: # preserve newest-first order among the chosen
|
||||
reason = reasons.get(rg.rg_mbid)
|
||||
if reason is not None:
|
||||
|
||||
Reference in New Issue
Block a user