lfcircle, meta: fix incorrect rank algs
This commit is contained in:
parent
d2169ce784
commit
d3916aa641
12
lfcircle.py
12
lfcircle.py
|
@ -605,7 +605,7 @@ def _rank(
|
||||||
insort(ranking, _r, key=k)
|
insort(ranking, _r, key=k)
|
||||||
|
|
||||||
for i, _r in enumerate(reversed(ranking), start=1):
|
for i, _r in enumerate(reversed(ranking), start=1):
|
||||||
if _r.user == r.user:
|
if _r == r:
|
||||||
return i
|
return i
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
@ -643,22 +643,22 @@ def make_circle_report(
|
||||||
leaderboard_scrobble_pos=_rank(
|
leaderboard_scrobble_pos=_rank(
|
||||||
r=report,
|
r=report,
|
||||||
rs=listening_reports,
|
rs=listening_reports,
|
||||||
k=lambda r: r.listening_time_hours + r.scrobbles_count,
|
k=lambda r: r.scrobbles_count,
|
||||||
),
|
),
|
||||||
leaderboard_artists_pos=_rank(
|
leaderboard_artists_pos=_rank(
|
||||||
r=report,
|
r=report,
|
||||||
rs=listening_reports,
|
rs=listening_reports,
|
||||||
k=lambda r: r.listening_time_hours + r.artists_count,
|
k=lambda r: r.artists_count,
|
||||||
),
|
),
|
||||||
leaderboard_albums_pos=_rank(
|
leaderboard_albums_pos=_rank(
|
||||||
r=report,
|
r=report,
|
||||||
rs=listening_reports,
|
rs=listening_reports,
|
||||||
k=lambda r: r.listening_time_hours + r.albums_count,
|
k=lambda r: r.albums_count,
|
||||||
),
|
),
|
||||||
leaderboard_tracks_pos=_rank(
|
leaderboard_tracks_pos=_rank(
|
||||||
r=report,
|
r=report,
|
||||||
rs=listening_reports,
|
rs=listening_reports,
|
||||||
k=lambda r: r.listening_time_hours + r.tracks_count,
|
k=lambda r: r.tracks_count,
|
||||||
),
|
),
|
||||||
leaderboard_n=len(listening_reports),
|
leaderboard_n=len(listening_reports),
|
||||||
)
|
)
|
||||||
|
@ -674,7 +674,7 @@ def cli() -> None:
|
||||||
reports: list[ListeningReport] = []
|
reports: list[ListeningReport] = []
|
||||||
|
|
||||||
print(behaviour, file=stderr) if behaviour.verbose else ...
|
print(behaviour, file=stderr) if behaviour.verbose else ...
|
||||||
for i, target in enumerate(behaviour.targets):
|
for i, target in enumerate(set(behaviour.targets)):
|
||||||
try:
|
try:
|
||||||
reports.append(
|
reports.append(
|
||||||
get_listening_report(
|
get_listening_report(
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "lfcircle"
|
name = "lfcircle"
|
||||||
version = "0.1.1"
|
version = "0.1.2"
|
||||||
description = "last.fm statistics generator for your friend circle!"
|
description = "last.fm statistics generator for your friend circle!"
|
||||||
authors = ["Mark Joshwel <mark@joshwel.co>"]
|
authors = ["Mark Joshwel <mark@joshwel.co>"]
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
Loading…
Reference in a new issue