]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Should be ready to go now!
authorAnt Zucaro <azucaro@gmail.com>
Sat, 14 Jan 2012 15:40:56 +0000 (10:40 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 14 Jan 2012 15:40:56 +0000 (10:40 -0500)
xonstat/models.py
xonstat/views/submission.py

index b3201589406a7ba1a39e26afc8319633bb067a6d..c3a8011f4e7e3dc04e4ec301a8dc100a718e1e36 100755 (executable)
@@ -171,8 +171,6 @@ class Game(object):
                 adjustment = scorefactor_real - scorefactor_elo
                 eloadjust[ei.player_id] += adjustment
                 eloadjust[ej.player_id] -= adjustment
-                log.debug("elo adjustment values:")
-                log.debug(eloadjust)
         for pid in pids:
             elos[pid].elo = max(float(elos[pid].elo) + eloadjust[pid] * elos[pid].k * ep.global_K / float(len(elos) - 1), ep.floor)
             elos[pid].games += 1
index ec0f57bd2b59b932218236ffc4cb8f8768967488..7f011fbfa4df988a937e1050d3d7acd1c1b70ecc 100755 (executable)
@@ -275,7 +275,7 @@ def create_game(session=None, start_dt=None, game_type_cd=None,
                 filter(Game.match_id==match_id).one()\r
         # if a game under the same server and match_id found, \r
         # this is a duplicate game and can be ignored\r
-        raise pyramid.httpexceptions.HTTPOk\r
+        raise pyramid.httpexceptions.HTTPOk('OK')\r
     except NoResultFound, e:\r
         # server_id/match_id combination not found. game is ok to insert\r
         session.add(game)\r
@@ -544,9 +544,9 @@ def stats_submit(request):
                 "----- END REQUEST BODY -----\n\n")\r
 \r
         (idfp, status) = verify_request(request)\r
-        #if not idfp:\r
-            #log.debug("ERROR: Unverified request")\r
-            #raise pyramid.httpexceptions.HTTPUnauthorized("Unverified request")\r
+        if not idfp:\r
+            log.debug("ERROR: Unverified request")\r
+            raise pyramid.httpexceptions.HTTPUnauthorized("Unverified request")\r
 \r
         (game_meta, players) = parse_body(request)  \r
 \r
@@ -562,9 +562,9 @@ def stats_submit(request):
             log.debug("ERROR: Not enough real players")\r
             raise pyramid.httpexceptions.HTTPOk("OK")\r
 \r
-        #if is_blank_game(players):\r
-            #log.debug("ERROR: Blank game")\r
-            #raise pyramid.httpexceptions.HTTPOk("OK")\r
+        if is_blank_game(players):\r
+            log.debug("ERROR: Blank game")\r
+            raise pyramid.httpexceptions.HTTPOk("OK")\r
 \r
         # FIXME: if we have two players and game type is 'dm',\r
         # change this into a 'duel' gametype. This should be\r
@@ -606,11 +606,14 @@ def stats_submit(request):
                         player_events=player_events)\r
 \r
         # update elos\r
-        game.process_elos(session)\r
+        try:\r
+            game.process_elos(session)\r
+        except Exception as e:\r
+            log.debug('Error (non-fatal): elo processing failed.')\r
 \r
         session.commit()\r
         log.debug('Success! Stats recorded.')\r
         return Response('200 OK')\r
     except Exception as e:\r
         session.rollback()\r
-        raise e\r
+        return e\r