session.add(player)
-def update_fastest_cap(session, player_id, game_id, map_id, captime):
+def update_fastest_cap(session, player_id, game_id, map_id, captime, mod):
"""
Check the fastest cap time for the player and map. If there isn't
one, insert one. If there is, check if the passed time is faster.
# then check to see if the new captime is faster
try:
cur_fastest_cap = session.query(PlayerCaptime).filter_by(
- player_id=player_id, map_id=map_id).one()
+ player_id=player_id, map_id=map_id, mod=mod).one()
# current captime is faster, so update
if captime < cur_fastest_cap.fastest_cap:
except NoResultFound, e:
# none exists, so insert
- cur_fastest_cap = PlayerCaptime(player_id, game_id, map_id, captime)
+ cur_fastest_cap = PlayerCaptime(player_id, game_id, map_id, captime,
+ mod)
session.add(cur_fastest_cap)
session.flush()
pgstat.fastest = datetime.timedelta(seconds=float(value)/100)
if game.game_type_cd == 'ctf':
update_fastest_cap(session, player.player_id, game.game_id,
- gmap.map_id, pgstat.fastest)
+ gmap.map_id, pgstat.fastest, game.mod)
# there is no "winning team" field, so we have to derive it
if wins and pgstat.team is not None and game.winner is None: