summaryrefslogtreecommitdiff
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
parentaa6cee0ad6bbe52b076c2a215e4b1c6fc9d1e0dd (diff)
* race and rating chronology disambiguation (+documentation)
-rw-r--r--doc/races.txt2
-rw-r--r--doc/results.txt6
-rw-r--r--f1elo/interface.py4
-rw-r--r--f1elo/model.py2
4 files changed, 7 insertions, 7 deletions
diff --git a/doc/races.txt b/doc/races.txt
index e3ae7c7..2ca20da 100644
--- a/doc/races.txt
+++ b/doc/races.txt
@@ -6,7 +6,7 @@ Races included in the standings:
* all non-championship races run to contemporary or nearly contemporary Formula One regulations since 1950, apart from national championship series (so Races of Champions, International Trophies, Bologna Sprints or non-championship Grands Prix are included, but Aurora F1, Tasman Series or South African F1 races are excluded)
* some of the 1952-53 non-championship Formula Two races (including these with substantial WDC drivers appearence, such as French Formula Two Championship races and some other arbitrary races)
* all post-War, pre-1950 Grandes Épreuves races (which includes some 1946 races from before F1 regulations and excludes majority of F1-compliant races from 1947 onwards)
- * races with mixed formula entries (e.g. F1/F2 or F1/FLibre) are separated by class and only F1 class (and F2 class in 1952-53) is scored
+ * races with mixed formula entries (e.g. F1/F2 or F1/FLibre) are separated by class and only F1 class (and F2 class in 1952-53) is scored, apart from joined F1-F2 World Championship races (German Grands Prix from 50s and 60s and 1958 Moroccan GP)
Race importance factor:
* WCoD and FOWC race importance constitutes 100% of base value
diff --git a/doc/results.txt b/doc/results.txt
index 13a56f3..43dda5b 100644
--- a/doc/results.txt
+++ b/doc/results.txt
@@ -17,9 +17,9 @@ After separating session results into groups, all entries from non-"0" groups fo
All such duels are then treated as input for Elo rating algorithm.
Specific rules regarding Elo implementation for this application's purposes:
- * rankings are applied (evaluated) after each session ("tournament")
+ * rankings are applied (evaluated) after each session (note: debug information for Bologna Sprints does not display correct "previous" ratings: ratings are applied after each heat, yeat debug info displays inital rating from before the event; this applies to any possible situation in which drivers take part in multiple sessions in one day)
* no minimum rating limit for driver is enforced
- * drivers are rated from their first entry (there's no initial grace period)
+ * drivers are rated from their first entry (there's no initial grace period, see: challenges.txt)
* shared drive entries have the effective ranking equal to the average ranking of drivers sharing the drive; pending ranking points from duels of such entries are divided equally between drivers sharing the drive
* driver group disparity is varied to accommodate for dynamic shifts of relative performance within the F1 field (caused by technical changes) - see below
@@ -39,4 +39,4 @@ Specific parameters which are configurable:
* duel importance (base, i.e. for drivers ranked below importance thresholds) for all race types
* importance thresholds (for 50% of base importance and 75% of base importance)
-All calculation is rounded to 2 decimal places.
+All calculation is rounded to 2 decimal places at each rating cycle.
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)