diff --git a/vrobbler/apps/charts/views.py b/vrobbler/apps/charts/views.py index 65fd547..d5882eb 100644 --- a/vrobbler/apps/charts/views.py +++ b/vrobbler/apps/charts/views.py @@ -233,55 +233,67 @@ class ChartRecordView(TemplateView): }, } + # List-group tables default to week-level when no date param (matches active tab) + if not date_param: + list_year = current_year + list_month = None + list_week = current_week + list_day = None + else: + list_year = year + list_month = month + list_week = week + list_day = day + context["charts"] = { "artist": list( self.get_charts_for_period( - user, "artist", year=year, month=month, week=week, day=day, limit=20 + user, "artist", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "album": list( self.get_charts_for_period( - user, "album", year=year, month=month, week=week, day=day, limit=20 + user, "album", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "track": list( self.get_charts_for_period( - user, "track", year=year, month=month, week=week, day=day, limit=20 + user, "track", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "tv_series": list( self.get_charts_for_period( - user, "tv_series", year=year, month=month, week=week, day=day, limit=20 + user, "tv_series", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "video": list( self.get_charts_for_period( - user, "video", year=year, month=month, week=week, day=day, limit=20 + user, "video", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "board_game": list( self.get_charts_for_period( - user, "board_game", year=year, month=month, week=week, day=day, limit=20 + user, "board_game", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "book": list( self.get_charts_for_period( - user, "book", year=year, month=month, week=week, day=day, limit=20 + user, "book", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "food": list( self.get_charts_for_period( - user, "food", year=year, month=month, week=week, day=day, limit=20 + user, "food", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "podcast": list( self.get_charts_for_period( - user, "podcast", year=year, month=month, week=week, day=day, limit=20 + user, "podcast", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), "trail": list( self.get_charts_for_period( - user, "trail", year=year, month=month, week=week, day=day, limit=20 + user, "trail", year=list_year, month=list_month, week=list_week, day=list_day, limit=20 ) ), } diff --git a/vrobbler/templates/scrobbles/_top_charts.html b/vrobbler/templates/scrobbles/_top_charts.html index f3ca877..d2c1c37 100644 --- a/vrobbler/templates/scrobbles/_top_charts.html +++ b/vrobbler/templates/scrobbles/_top_charts.html @@ -97,7 +97,7 @@