summaryrefslogtreecommitdiff
path: root/f1elo
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2014-11-12 11:32:19 +0100
committeremkael <emkael@tlen.pl>2014-11-12 11:32:19 +0100
commit0253320c01ff18eab97cde0bc74e13184a8a7487 (patch)
tree136e13445c3af3a8ccfcd6cb481fdf5387cadee5 /f1elo
parentaa6cee0ad6bbe52b076c2a215e4b1c6fc9d1e0dd (diff)
* race and rating chronology disambiguation (+documentation)
Diffstat (limited to 'f1elo')
-rw-r--r--f1elo/interface.py4
-rw-r--r--f1elo/model.py2
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)