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
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
"----- 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
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
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