[templates] Add counts and durations to new tables
This commit is contained in:
@ -635,6 +635,14 @@ class Scrobble(TimeStampedModel):
|
||||
|
||||
for scrobble in scrobble_qs:
|
||||
scrobbles_by_type[scrobble.media_type].append(scrobble)
|
||||
if not scrobbles_by_type.get(scrobble.media_type + "_count"):
|
||||
scrobbles_by_type[scrobble.media_type + "_count"] = 0
|
||||
scrobbles_by_type[scrobble.media_type + "_count"] += 1
|
||||
if not scrobbles_by_type.get(scrobble.media_type + "_time"):
|
||||
scrobbles_by_type[scrobble.media_type + "_time"] = 0
|
||||
scrobbles_by_type[scrobble.media_type + "_time"] += int(
|
||||
(scrobble.elapsed_time)
|
||||
)
|
||||
|
||||
return scrobbles_by_type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user