Add chart view when not auth'd

This commit is contained in:
2023-03-10 11:30:23 -05:00
parent 489d8b9152
commit d79159670e
2 changed files with 9 additions and 7 deletions

View File

@ -117,9 +117,11 @@ class RecentScrobbleList(ListView):
"year": list(live_charts(**track, chart_period="year")),
"all": list(live_charts(**track)),
}
data["counts"] = scrobble_counts(user)
else:
data["weekly_data"] = week_of_scrobbles()
data["counts"] = scrobble_counts()
# data["weekly_data"] = week_of_scrobbles(user=user)
data["counts"] = scrobble_counts(user)
data["imdb_form"] = ScrobbleForm
data["export_form"] = ExportScrobbleForm
return data

View File

@ -78,8 +78,9 @@
</div>
</div>
{% if show_chart %}
<canvas class="my-4 w-100" id="myChart" width="900" height="150"></canvas>
{% if not user.is_authenticated %}
<p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
<canvas class="my-4 w-100" id="myChart" width="900" height="300"></canvas>
{% endif %}
<div class="container">
@ -434,8 +435,7 @@
<div class="row">
<h2>Last Scrobbles</h2>
<p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> |
This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
<p>Today <b>{{counts.today}}</b> | This Week <b>{{counts.week}}</b> | This Month <b>{{counts.month}}</b> | This Year <b>{{counts.year}}</b> | All Time <b>{{counts.alltime}}</b></p>
</div>
<div class="row">
<ul class="nav nav-tabs" id="myTab" role="tablist">
@ -670,7 +670,7 @@
scales: {
yAxes: [{
ticks: {
beginAtZero: false
beginAtZero: true
}
}]
},