Fixed album charts

This commit is contained in:
krateng 2023-10-29 01:38:58 +02:00
parent f6f1db6eac
commit 7d709ef6d9
3 changed files with 3 additions and 2 deletions

View File

@ -436,6 +436,7 @@ def get_charts_albums(dbconn=None,resolve_ids=True,only_own_albums=False,**keys)
if 'artist' in keys: if 'artist' in keys:
result = sqldb.count_scrobbles_by_album_combined(since=since,to=to,artist=keys['artist'],associated=keys.get('associated',False),resolve_ids=resolve_ids,dbconn=dbconn) result = sqldb.count_scrobbles_by_album_combined(since=since,to=to,artist=keys['artist'],associated=keys.get('associated',False),resolve_ids=resolve_ids,dbconn=dbconn)
if only_own_albums: if only_own_albums:
# TODO: this doesnt take associated into account and doesnt change ranks
result = [e for e in result if keys['artist'] in (e['album']['artists'] or [])] result = [e for e in result if keys['artist'] in (e['album']['artists'] or [])]
else: else:
result = sqldb.count_scrobbles_by_album(since=since,to=to,resolve_ids=resolve_ids,dbconn=dbconn) result = sqldb.count_scrobbles_by_album(since=since,to=to,resolve_ids=resolve_ids,dbconn=dbconn)

View File

@ -8,7 +8,7 @@
<script src="/datechange.js" async></script> <script src="/datechange.js" async></script>
{% endblock %} {% endblock %}
{% set charts = dbc.get_charts_albums(filterkeys,limitkeys,{'only_own_albums':True}) %} {% set charts = dbc.get_charts_albums(filterkeys,limitkeys,{'only_own_albums':False}) %}
{% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %} {% set pages = math.ceil(charts.__len__() / amountkeys.perpage) %}
{% if charts[0] is defined %} {% if charts[0] is defined %}
{% set topalbum = charts[0].album %} {% set topalbum = charts[0].album %}

View File

@ -2,7 +2,7 @@
{% import 'snippets/entityrow.jinja' as entityrow %} {% import 'snippets/entityrow.jinja' as entityrow %}
{% if charts is undefined %} {% if charts is undefined %}
{% set charts = dbc.get_charts_albums(filterkeys,limitkeys,{'only_own_albums':True}) %} {% set charts = dbc.get_charts_albums(filterkeys,limitkeys,{'only_own_albums':False}) %}
{% endif %} {% endif %}
{% if compare %} {% if compare %}
{% if compare is true %} {% if compare is true %}