From e1eacbb27228f78f6c4a7050389d14a240ec7107 Mon Sep 17 00:00:00 2001 From: Krateng Date: Wed, 20 Nov 2019 21:11:10 +0100 Subject: [PATCH] More concise medal code --- database.py | 4 ++-- website/artist.pyhp | 35 +++++++++++++++-------------------- website/track.pyhp | 34 ++++++++++++++-------------------- 3 files changed, 31 insertions(+), 42 deletions(-) diff --git a/database.py b/database.py index 2b76b7c..cdfd125 100644 --- a/database.py +++ b/database.py @@ -572,7 +572,7 @@ def artistInfo(artist): "scrobbles":scrobbles, "position":position, "associated":others, - "medals":MEDALS.get(artist), + "medals":{"gold":[],"silver":[],"bronze":[],**MEDALS.get(artist,{})}, "topweeks":WEEKLY_TOPARTISTS.get(artist,0) } except: @@ -616,7 +616,7 @@ def trackInfo(track): return { "scrobbles":scrobbles, "position":position, - "medals":MEDALS_TRACKS.get((frozenset(track["artists"]),track["title"])), + "medals":{"gold":[],"silver":[],"bronze":[],**MEDALS_TRACKS.get((frozenset(track["artists"]),track["title"]),{})}, "certification":cert, "topweeks":WEEKLY_TOPTRACKS.get(((frozenset(track["artists"]),track["title"])),0) } diff --git a/website/artist.pyhp b/website/artist.pyhp index 23141c9..1f8cbb8 100644 --- a/website/artist.pyhp +++ b/website/artist.pyhp @@ -57,22 +57,17 @@

Scrobbles

- - - - + + - - - - + + - - - - + + + @@ -85,10 +80,10 @@ @@ -100,10 +95,10 @@ - + - + @@ -126,10 +121,10 @@ - + - + diff --git a/website/track.pyhp b/website/track.pyhp index f78d0c3..d8abdea 100644 --- a/website/track.pyhp +++ b/website/track.pyhp @@ -33,20 +33,14 @@

Scrobbles

- - - - + + - - - - + + - - - - + + @@ -56,10 +50,10 @@
@@ -71,10 +65,10 @@ - + - + @@ -97,10 +91,10 @@ - + - +