Minor stuff

This commit is contained in:
krateng 2022-01-09 07:50:34 +01:00
parent eb9cd4aba4
commit b50afe70ea
5 changed files with 11 additions and 8 deletions

View File

@ -251,10 +251,10 @@ def artist_info(artist):
except:
# if the artist isnt in the charts, they are not being credited and we
# need to show information about the credited one
artist = sqldb.get_credited_artists(artist)[0]
c = [e for e in alltimecharts if e["artist"] == artist][0]
replaceartist = sqldb.get_credited_artists(artist)[0]
c = [e for e in alltimecharts if e["artist"] == replaceartist][0]
position = c["rank"]
return {"replace":artist,"scrobbles":scrobbles,"position":position}
return {"artist":artist,"replace":replaceartist,"scrobbles":scrobbles,"position":position}

View File

@ -377,7 +377,9 @@ def count_scrobbles_by_artist(since,to):
).select_from(jointable2).where(
DB['scrobbles'].c.timestamp<=to,
DB['scrobbles'].c.timestamp>=since
).group_by(sql.func.coalesce(DB['associated_artists'].c.target_artist,DB['trackartists'].c.artist_id)).order_by(sql.desc('count'))
).group_by(
sql.func.coalesce(DB['associated_artists'].c.target_artist,DB['trackartists'].c.artist_id)
).order_by(sql.desc('count'))
result = conn.execute(op).all()

View File

@ -35,6 +35,7 @@ def update_jinja_environment():
# external
"urllib": urllib,
"math":math,
"print":print, # TODO: remove this
# config
"ranges": [
('day','7 days',malojatime.today().next(-6),'day',7),

View File

@ -1,5 +1,5 @@
{% extends "abstracts/base.jinja" %}
{% block title %}Maloja - {{ artist }}{% endblock %}
{% block title %}Maloja - {{ info.artist }}{% endblock %}
{% import 'snippets/links.jinja' as links %}
{% import 'partials/awards_artist.jinja' as awards %}
@ -47,7 +47,7 @@
{% endif %}
</td>
<td class="text">
<h1 class="headerwithextra">{{ artist }}</h1>
<h1 class="headerwithextra">{{ info.artist }}</h1>
{% if competes %}<span class="rank"><a href="/charts_artists?max=100">#{{ info.position }}</a></span>{% endif %}
<br/>
{% if competes and included %}

View File

@ -1,5 +1,5 @@
{% extends "abstracts/base.jinja" %}
{% block title %}Maloja - {{ track.title }}{% endblock %}
{% block title %}Maloja - {{ info.track.title }}{% endblock %}
{% import 'snippets/links.jinja' as links %}
@ -42,7 +42,7 @@
</td>
<td class="text">
<span>{{ links.links(track.artists) }}</span><br/>
<h1 class="headerwithextra">{{ track.title }}</h1>
<h1 class="headerwithextra">{{ info.track.title }}</h1>
{{ awards.certs(track) }}
<span class="rank"><a href="/charts_tracks?max=100">#{{ info.position }}</a></span>
<br/>