Winrate over time incluces today
This commit is contained in:
parent
61d7abd7f3
commit
9a181367c1
1 changed files with 13 additions and 0 deletions
|
|
@ -375,6 +375,19 @@ def get_winrate_over_time(session: Session, player_name: str | None = None, day_
|
||||||
else:
|
else:
|
||||||
timeline_dict[current_date] = 0
|
timeline_dict[current_date] = 0
|
||||||
|
|
||||||
|
current_date == date.today()
|
||||||
|
playplayers_at_date = list(filter(lambda playplayer: playplayer.play.play_date <= current_date, all_playplayers))
|
||||||
|
total_games_played = len(playplayers_at_date)
|
||||||
|
total_games_won = 0
|
||||||
|
for playplayer in playplayers_at_date:
|
||||||
|
if playplayer.has_won:
|
||||||
|
total_games_won += 1
|
||||||
|
|
||||||
|
if total_games_played != 0:
|
||||||
|
timeline_dict[current_date] = total_games_won / total_games_played
|
||||||
|
else:
|
||||||
|
timeline_dict[current_date] = 0
|
||||||
|
|
||||||
|
|
||||||
statistic_dict = {
|
statistic_dict = {
|
||||||
'name': statistic_name,
|
'name': statistic_name,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue