Files
music_library/backlog/completed/ml-65 - Move-scrobble-queries-out-of-Records-context.md
T
Claudio Ortolina 2a688e2309 Cleanup old tasks
2026-04-24 09:58:09 +01:00

1.1 KiB

id, title, status, assignee, created_date, labels, dependencies, references, priority
id title status assignee created_date labels dependencies references priority
ML-65 Move scrobble queries out of Records context Done
2026-04-20 08:55
https://github.com/cloud8421/music_library/issues/110
medium

Description

GitHub: created 2026-03-12 · updated 2026-03-12 · closed 2026-03-12

Problem

MusicLibrary.Records directly queries LastFm.Track in three places: get_last_listened_track/1, play_count/1, scrobbles_for_record_query/1. This is a cross-domain leak — scrobble data belongs to the listening/stats domain.

Proposed solution

Move get_last_listened_track/1 and play_count/1 into MusicLibrary.ListeningStats. Update LiveView callers (CollectionLive.Show, WishlistLive.Show) to call ListeningStats instead of Records. Remove LastFm.Track alias from Records.

Files involved

  • lib/music_library/records.ex
  • lib/music_library/listening_stats.ex
  • lib/music_library_web/live/collection_live/show.ex
  • lib/music_library_web/live/wishlist_live/show.ex
  • Tests for the above