class PlayerCaptime(object):
def __init__(self, player_id=None, game_id=None, map_id=None,
- fastest_cap=None):
+ fastest_cap=None, mod=None):
self.player_id = player_id
self.game_id = game_id
self.map_id = map_id
self.fastest_cap = fastest_cap
+ self.mod = mod
def __repr__(self):
- return "<PlayerCaptime(pid=%s, map_id=%s)>" % (self.player_id, self.map_id)
+ return "<PlayerCaptime(pid=%s, map_id=%s, mod=%s)>" % (self.player_id,
+ self.map_id, self.mod)
def fuzzy_date(self):
return pretty_date(self.create_dt)
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: