Permalink
Browse files

added mu and sigma to match record

  • Loading branch information...
1 parent a6e9462 commit 4d817e710d0fd6dd935c5416de31b2ae9bc2c4b3 @artnez committed May 13, 2012
Showing with 16 additions and 4 deletions.
  1. +7 −4 src/faceoff/models/match.py
  2. 0 src/faceoff/schema/0.3.0
  3. +9 −0 src/faceoff/schema/0.3.0.sql
@@ -122,10 +122,13 @@ def rebuild_rankings(db, league_id):
# create rankings
for (i, r) in enumerate(rankings):
- db.execute(
- 'INSERT INTO ranking (league_id, user_id, rank, wins, losses, win_streak, loss_streak, games) ' \
- 'VALUES (?, ?, ?, ?, ?, ?, ?, ?)',
- [league_id, r['id'], (i+1), r['win'], r['loss'], r['win_streak'], r['loss_streak'], r['games']])
+ fields = {
+ 'league_id': league_id, 'user_id': r['id'], 'rank': (i+1),
+ 'mu': r['rating'].mu, 'sigma': r['rating'].sigma, 'wins': r['win'],
+ 'losses': r['loss'], 'win_streak': r['win_streak'],
+ 'loss_streak': r['loss_streak'], 'games': r['games']
+ }
+ db.insert('ranking', pk=False, **fields)
if not db.is_building:
db.commit()
No changes.
@@ -0,0 +1,9 @@
+/**
+ * Adds `mu` and `sigma` to matches.
+ *
+ * Copyright: (c) 2012 Artem Nezvigin <artem@artnez.com>
+ * License: MIT, see LICENSE for details
+ */
+
+ALTER TABLE ranking ADD COLUMN mu vARCHAR(64);
+ALTER TABLE ranking ADD COLUMN sigma vARCHAR(64);

0 comments on commit 4d817e7

Please sign in to comment.