mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Updated some database calls to no longer calculate rank themselves
This commit is contained in:
parent
5c2d9640ac
commit
8dcc2766a5
15
database.py
15
database.py
@ -461,16 +461,14 @@ def artistInfo(artist):
|
|||||||
try:
|
try:
|
||||||
c = [e for e in charts if e["artist"] == artist][0]
|
c = [e for e in charts if e["artist"] == artist][0]
|
||||||
others = coa.getAllAssociated(artist)
|
others = coa.getAllAssociated(artist)
|
||||||
position = charts.index(c)
|
position = c["rank"]
|
||||||
while position != 0 and c["scrobbles"] == charts[position-1]["scrobbles"]: position -= 1
|
return {"scrobbles":scrobbles,"position":position,"associated":others,"medals":MEDALS.get(artist)}
|
||||||
return {"scrobbles":scrobbles,"position":position + 1,"associated":others,"medals":MEDALS.get(artist)}
|
|
||||||
except:
|
except:
|
||||||
# if the artist isnt in the charts, they are not being credited and we need to show information about the credited one
|
# if the artist isnt in the charts, they are not being credited and we need to show information about the credited one
|
||||||
artist = coa.getCredited(artist)
|
artist = coa.getCredited(artist)
|
||||||
c = [e for e in charts if e["artist"] == artist][0]
|
c = [e for e in charts if e["artist"] == artist][0]
|
||||||
position = charts.index(c)
|
position = c["rank"]
|
||||||
while position != 0 and c["scrobbles"] == charts[position-1]["scrobbles"]: position -= 1
|
return {"replace":artist,"scrobbles":scrobbles,"position":position}
|
||||||
return {"replace":artist,"scrobbles":scrobbles,"position":position + 1}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -490,10 +488,9 @@ def trackInfo(artists,title):
|
|||||||
#scrobbles = len(db_query(artists=artists,title=title)) #chart entry of track always has right scrobble number, no countas rules here
|
#scrobbles = len(db_query(artists=artists,title=title)) #chart entry of track always has right scrobble number, no countas rules here
|
||||||
c = [e for e in charts if set(e["track"]["artists"]) == set(artists) and e["track"]["title"] == title][0]
|
c = [e for e in charts if set(e["track"]["artists"]) == set(artists) and e["track"]["title"] == title][0]
|
||||||
scrobbles = c["scrobbles"]
|
scrobbles = c["scrobbles"]
|
||||||
position = charts.index(c)
|
position = c["rank"]
|
||||||
while position != 0 and c["scrobbles"] == charts[position-1]["scrobbles"]: position -= 1
|
|
||||||
|
|
||||||
return {"scrobbles":scrobbles,"position":position + 1,"medals":MEDALS_TRACKS.get((frozenset(artists),title))}
|
return {"scrobbles":scrobbles,"position":position,"medals":MEDALS_TRACKS.get((frozenset(artists),title))}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user