From 0253320c01ff18eab97cde0bc74e13184a8a7487 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 12 Nov 2014 11:32:19 +0100 Subject: * race and rating chronology disambiguation (+documentation) --- f1elo/interface.py | 4 ++-- f1elo/model.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'f1elo') diff --git a/f1elo/interface.py b/f1elo/interface.py index 3768f8a..a492bba 100644 --- a/f1elo/interface.py +++ b/f1elo/interface.py @@ -58,7 +58,7 @@ class Interface: race_query = self.session.query(Race).filter(Race.ranked == False) if date is not None: race_query = race_query.filter(Race.date <= date) - races = race_query.order_by(Race.date).all() + races = race_query.order_by(Race.date, Race.id).all() for race in races: if _debug: @@ -76,7 +76,7 @@ class Interface: for driver, rank in driver_ranks.iteritems(): ranking = Ranking() ranking.rank_date = race.date - ranking.ranking = elo.get_ranking(driver, race.date) + rank + ranking.ranking = round(elo.get_ranking(driver, race.date) + rank, 2) self.session.add(ranking) driver.rankings.append(ranking) diff --git a/f1elo/model.py b/f1elo/model.py index 33e60ac..cb78d1a 100644 --- a/f1elo/model.py +++ b/f1elo/model.py @@ -15,7 +15,7 @@ class Driver(Base): rankings = relationship( 'Ranking', - order_by='Ranking.rank_date', + order_by='Ranking.rank_date,Ranking.id', back_populates='driver', cascade="all", passive_deletes=True) -- cgit v1.2.3