diff options
author | emkael <emkael@tlen.pl> | 2016-11-04 00:29:33 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-11-04 00:29:33 +0100 |
commit | cc54c5625f707633183c35a57e02a89c674cb260 (patch) | |
tree | 22313f35e87543bfe401f7318135dd7c6bd32b26 /f1elo/interface.py | |
parent | c4807edeeb1b1315f8a54bdafaed8f29e3639e01 (diff) |
* average rating change in log file calculated only for rated entries
Diffstat (limited to 'f1elo/interface.py')
-rw-r--r-- | f1elo/interface.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/f1elo/interface.py b/f1elo/interface.py index 77307ae..6cca847 100644 --- a/f1elo/interface.py +++ b/f1elo/interface.py @@ -86,12 +86,15 @@ class Interface: podium_rating_after = 0 rating_sum = 0 rating_change_sum = 0 + changed_ratings = 0 for entry in sorted(race.entries): old_rating = elo.get_entry_ranking(entry, race.date - dateutil.relativedelta.relativedelta(days=1)) new_rating = elo.get_entry_ranking(entry) rating_sum += old_rating - rating_change_sum += abs(new_rating - old_rating) + if entry.result_group != 0: + rating_change_sum += abs(new_rating - old_rating) + changed_ratings += 1 print( entry, old_rating, @@ -103,7 +106,7 @@ class Interface: print('', file=sys.stderr) print('Podium rating: ', podium_rating, podium_rating_after, file=sys.stderr) print('Average rating: ', rating_sum / len(race.entries), file=sys.stderr) - print('Average rating change: ', rating_change_sum / len(race.entries), file=sys.stderr) + print('Average rating change: ', rating_change_sum / changed_ratings, file=sys.stderr) print('', file=sys.stderr) race.ranked = True |