From fa05c406606e269fb4153465611caeb71c12b486 Mon Sep 17 00:00:00 2001 From: Krateng Date: Sun, 23 Aug 2020 01:30:50 +0200 Subject: [PATCH] Fixed bug with chart bars --- maloja/__pkginfo__.py | 2 +- maloja/web/jinja/charts_artists.jinja | 2 -- maloja/web/jinja/charts_tracks.jinja | 2 -- maloja/web/jinja/partials/performance.jinja | 12 ++++-------- maloja/web/jinja/partials/pulse.jinja | 8 ++------ 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/maloja/__pkginfo__.py b/maloja/__pkginfo__.py index 8a94f72..fc93547 100644 --- a/maloja/__pkginfo__.py +++ b/maloja/__pkginfo__.py @@ -5,7 +5,7 @@ author = { "email":"maloja@krateng.dev", "github": "krateng" } -version = 2,7,4 +version = 2,7,5 versionstr = ".".join(str(n) for n in version) links = { "pypi":"malojaserver", diff --git a/maloja/web/jinja/charts_artists.jinja b/maloja/web/jinja/charts_artists.jinja index 8f65da2..ad8aaeb 100644 --- a/maloja/web/jinja/charts_artists.jinja +++ b/maloja/web/jinja/charts_artists.jinja @@ -35,11 +35,9 @@ {% import 'partials/charts_artists.jinja' as charts_artists %} - {{ charts_artists.charts_artists(limitkeys,amountkeys,compare=true) }} {% import 'snippets/pagination.jinja' as pagination %} - {{ pagination.pagination(filterkeys,limitkeys,delimitkeys,amountkeys,pages) }} {% endblock %} diff --git a/maloja/web/jinja/charts_tracks.jinja b/maloja/web/jinja/charts_tracks.jinja index d8ba310..5bd6ec5 100644 --- a/maloja/web/jinja/charts_tracks.jinja +++ b/maloja/web/jinja/charts_tracks.jinja @@ -35,11 +35,9 @@ {% import 'partials/charts_tracks.jinja' as charts_tracks %} - {{ charts_tracks.charts_tracks(filterkeys,limitkeys,amountkeys,charts=charts,compare=true) }} {% import 'snippets/pagination.jinja' as pagination %} - {{ pagination.pagination(filterkeys,limitkeys,delimitkeys,amountkeys,pages) }} {% endblock %} diff --git a/maloja/web/jinja/partials/performance.jinja b/maloja/web/jinja/partials/performance.jinja index 639d1ff..e87ff69 100644 --- a/maloja/web/jinja/partials/performance.jinja +++ b/maloja/web/jinja/partials/performance.jinja @@ -2,13 +2,9 @@ {% set ranges = dbp.get_performance(filterkeys,limitkeys,delimitkeys) %} -{% set minrank = 80 %} -{% for r in ranges %} - {% if r.rank is not none and r.rank+20 > minrank %} - {% set minrank = r.rank+20 %} - {% endif %} -{% endfor %} - +{% set minrank = ranges|map(attribute="rank")|reject("none")|max|default(60) %} +{% set minrank = minrank + 20 %} +{% if minrank < 80 %}{% set minrank = 80 %}{% endif %} {% for t in ranges %} @@ -25,7 +21,7 @@ - + {% endfor %}
diff --git a/maloja/web/jinja/partials/pulse.jinja b/maloja/web/jinja/partials/pulse.jinja index ebb6b95..5fd76eb 100644 --- a/maloja/web/jinja/partials/pulse.jinja +++ b/maloja/web/jinja/partials/pulse.jinja @@ -2,12 +2,8 @@ {% set ranges = dbp.get_pulse(filterkeys,limitkeys,delimitkeys) %} -{% set maxbar = 1 %} -{% for r in ranges %} - {% if r.scrobbles > maxbar %} - {% set maxbar = r.scrobbles %} - {% endif %} -{% endfor %} +{% set maxbar = ranges|map(attribute="scrobbles")|max|default(1) %} +{% if maxbar < 1 %}{% set maxbar = 1 %}{% endif %} {% for t in ranges %}