[views] Move elaborate charts to the charts page
This commit is contained in:
@ -664,6 +664,33 @@ class ChartRecordView(TemplateView):
|
|||||||
),
|
),
|
||||||
"all": live_charts(**track_params, limit=limit),
|
"all": live_charts(**track_params, limit=limit),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
context_data["chart_keys"] = {
|
||||||
|
"today": "Today",
|
||||||
|
"last7": "Last 7 days",
|
||||||
|
"last30": "Last 30 days",
|
||||||
|
"year": "This year",
|
||||||
|
"all": "All time",
|
||||||
|
}
|
||||||
|
context_data["current_artist_charts"] = {
|
||||||
|
"today": list(live_charts(**artist, chart_period="today")),
|
||||||
|
"last7": list(live_charts(**artist, chart_period="last7")),
|
||||||
|
"last30": list(live_charts(**artist, chart_period="last30")),
|
||||||
|
"year": list(live_charts(**artist, chart_period="year")),
|
||||||
|
"all": list(live_charts(**artist)),
|
||||||
|
}
|
||||||
|
|
||||||
|
track = {"user": user, "media_type": "Track", "limit": limit}
|
||||||
|
context_data["current_track_charts"] = {
|
||||||
|
"today": list(live_charts(**track, chart_period="today")),
|
||||||
|
"last7": list(live_charts(**track, chart_period="last7")),
|
||||||
|
"last30": list(live_charts(**track, chart_period="last30")),
|
||||||
|
"year": list(live_charts(**track, chart_period="year")),
|
||||||
|
"all": list(live_charts(**track)),
|
||||||
|
}
|
||||||
return context_data
|
return context_data
|
||||||
|
|
||||||
# Date provided, lookup past charts, returning nothing if it's now or in the future.
|
# Date provided, lookup past charts, returning nothing if it's now or in the future.
|
||||||
|
|||||||
@ -3,6 +3,11 @@
|
|||||||
{% block title %}{{name}}{% endblock %}
|
{% block title %}{{name}}{% endblock %}
|
||||||
|
|
||||||
{% block lists %}
|
{% block lists %}
|
||||||
|
|
||||||
|
<div "calss="row>
|
||||||
|
{% include "scrobbles/_top_charts.html" %}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% if artist_charts %}
|
{% if artist_charts %}
|
||||||
<div class="col-md">
|
<div class="col-md">
|
||||||
|
|||||||
@ -82,19 +82,14 @@
|
|||||||
{% if not user.is_authenticated %}
|
{% 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>
|
<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>
|
<canvas class="my-4 w-100" id="myChart" width="900" height="300"></canvas>
|
||||||
{% endif %}
|
{% else %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% if user.is_authenticated %}
|
|
||||||
<div class="row">
|
|
||||||
{% include "scrobbles/_top_charts.html" %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% include "scrobbles/_last_scrobbles.html" %}
|
{% include "scrobbles/_last_scrobbles.html" %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<div class="modal fade" id="importModal" tabindex="-1" role="dialog" aria-labelledby="importModalLabel"
|
<div class="modal fade" id="importModal" tabindex="-1" role="dialog" aria-labelledby="importModalLabel"
|
||||||
|
|||||||
Reference in New Issue
Block a user