Dramatically simplify the scrobblig code

This commit is contained in:
2023-01-12 21:33:45 -05:00
parent 507b3aaaf2
commit 3f8b29f5ee
13 changed files with 273 additions and 199 deletions

View File

@ -18,7 +18,7 @@ STARTING_DAY_OF_CURRENT_YEAR = NOW.date().replace(month=1, day=1)
def scrobble_counts():
finished_scrobbles_qs = Scrobble.objects.filter(in_progress=False)
finished_scrobbles_qs = Scrobble.objects.filter(played_to_completion=True)
data = {}
data['today'] = finished_scrobbles_qs.filter(
timestamp__gte=START_OF_TODAY
@ -53,7 +53,7 @@ def week_of_scrobbles(media: str = 'tracks') -> dict[str, int]:
.filter(
timestamp__gte=start,
timestamp__lte=end,
in_progress=False,
played_to_completion=True,
)
.count()
)