From 34abbe753be9cf0786de168e5b5985a88aa71281 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Fri, 3 Mar 2023 21:55:36 -0500 Subject: [PATCH] Fix a few display issues with charts --- vrobbler/apps/scrobbles/views.py | 27 ++--- .../templates/scrobbles/scrobble_list.html | 108 +++++++++--------- 2 files changed, 68 insertions(+), 67 deletions(-) diff --git a/vrobbler/apps/scrobbles/views.py b/vrobbler/apps/scrobbles/views.py index 77cb9dc..a567b6e 100644 --- a/vrobbler/apps/scrobbles/views.py +++ b/vrobbler/apps/scrobbles/views.py @@ -90,23 +90,24 @@ class RecentScrobbleList(ListView): user=self.request.user, ) - l = 14 - artist = {'user': user, 'media_type': 'Artist'} + limit = 14 + artist = {'user': user, 'media_type': 'Artist', 'limit': limit} + # This is weird. They don't display properly as QuerySets, so we cast to lists data['current_artist_charts'] = { - "today": live_charts(**artist, chart_period="today", limit=l), - "week": live_charts(**artist, chart_period="week", limit=l), - "month": live_charts(**artist, chart_period="month", limit=l), - "year": live_charts(**artist, chart_period="year", limit=l), - "all": live_charts(**artist, limit=l), + "today": list(live_charts(**artist, chart_period="today")), + "week": list(live_charts(**artist, chart_period="week")), + "month": list(live_charts(**artist, chart_period="month")), + "year": list(live_charts(**artist, chart_period="year")), + "all": list(live_charts(**artist)), } - track = {'user': user, 'media_type': 'Track'} + track = {'user': user, 'media_type': 'Track', 'limit': limit} data['current_track_charts'] = { - "today": live_charts(**track, chart_period="today", limit=l), - "week": live_charts(**track, chart_period="week", limit=l), - "month": live_charts(**track, chart_period="month", limit=l), - "year": live_charts(**track, chart_period="year", limit=l), - "all": live_charts(**track, limit=l), + "today": list(live_charts(**track, chart_period="today")), + "week": list(live_charts(**track, chart_period="week")), + "month": list(live_charts(**track, chart_period="month")), + "year": list(live_charts(**track, chart_period="year")), + "all": list(live_charts(**track)), } data["weekly_data"] = week_of_scrobbles(user=user) diff --git a/vrobbler/templates/scrobbles/scrobble_list.html b/vrobbler/templates/scrobbles/scrobble_list.html index 7208459..bb2cf1d 100644 --- a/vrobbler/templates/scrobbles/scrobble_list.html +++ b/vrobbler/templates/scrobbles/scrobble_list.html @@ -118,31 +118,31 @@ {% if artists.1.thumbnail %} {% else %} - + {% endif %}
#3 {{artists.2.name}}
{% if artists.2.thumbnail %} - + {% else %} - + {% endif %}
#4 {{artists.3.name}}
{% if artists.3.thumbnail %} - + {% else %} - + {% endif %}
#5 {{artists.4.name}}
{% if artists.4.thumbnail %} - + {% else %} - + {% endif %}
@@ -152,73 +152,73 @@
#6 {{artists.5.name}}
{% if artists.5.thumbnail %} - + {% else %} - + {% endif %}
#7 {{artists.6.name}}
{% if artists.6.thumbnail %} - + {% else %} - + {% endif %}
#8 {{artists.7.name}}
{% if artists.7.thumbnail %} - + {% else %} - + {% endif %}
#9 {{artists.8.name}}
{% if artists.8.thumbnail %} - + {% else %} - + {% endif %}
#10 {{artists.9.name}}
{% if artists.9.thumbnail %} - + {% else %} - + {% endif %}
#11 {{artists.10.name}}
{% if artists.10.thumbnail %} - + {% else %} - + {% endif %}
#12 {{artists.11.name}}
{% if artists.11.thumbnail %} - + {% else %} - + {% endif %}
#13 {{artists.12.name}}
- {% if artists.12thumbnail %} - + {% if artists.12.thumbnail %} + {% else %} - + {% endif %}
#14 {{artists.13.name}}
{% if artists.13.thumbnail %} - + {% else %} - + {% endif %}
@@ -250,9 +250,9 @@
#1 {{tracks.0.title}}
{% if tracks.0.album.cover_image %} - + {% else %} - + {% endif %}
@@ -261,33 +261,33 @@
#2 {{tracks.1.title}}
{% if tracks.1.album.cover_image %} - + {% else %} - + {% endif %}
#3 {{tracks.2.title}}
{% if tracks.2.album.cover_image %} - + {% else %} - + {% endif %}
#4 {{tracks.3.title}}
{% if tracks.3.album.cover_image %} - + {% else %} - + {% endif %}
#5 {{tracks.4.title}}
{% if tracks.4.album.cover_image %} - + {% else %} - + {% endif %}
@@ -297,73 +297,73 @@
#6 {{tracks.5.title}}
{% if tracks.5.album.cover_image %} - + {% else %} - + {% endif %}
#7 {{tracks.6.title}}
{% if tracks.6.album.cover_image %} - + {% else %} - + {% endif %}
#8 {{tracks.7.title}}
{% if tracks.7.album.cover_image %} - + {% else %} - + {% endif %}
#9 {{tracks.8.title}}
{% if tracks.8.album.cover_image %} - + {% else %} - + {% endif %}
#10 {{tracks.9.title}}
{% if tracks.9.album.cover_image %} - + {% else %} - + {% endif %}
#11 {{tracks.10.title}}
{% if tracks.10.album.cover_image %} - + {% else %} - + {% endif %}
#12 {{tracks.11.title}}
{% if tracks.11.album.cover_image %} - + {% else %} - + {% endif %}
#13 {{tracks.12.title}}
{% if tracks.12.album.cover_image %} - + {% else %} - + {% endif %}
#14 {{tracks.13.title}}
{% if tracks.13.album.cover_image %} - + {% else %} - + {% endif %}