diff options
Diffstat (limited to 'f1elo')
-rw-r--r-- | f1elo/interface.py | 4 | ||||
-rw-r--r-- | f1elo/model.py | 2 |
2 files changed, 3 insertions, 3 deletions
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) |