filter(Game.map_id == Map.map_id).\
order_by(Game.game_id.desc())[0:10]
- log.debug(recent_games)
except Exception as e:
player = None
recent_games = None
games = Page(games_q, current_page, url=page_url)
- log.debug(games)
- log.debug(player)
except Exception as e:
player = None
games = Page(games_q, current_page, url=page_url)
- log.debug(games)
-
return {'games':games}
order_by(Game.game_id.desc())
games = Page(games_q, current_page, url=page_url)
-
- log.debug("Server is:")
- log.debug(server)
- log.debug("Games is:")
- log.debug(games)
except Exception as e:
server = None
games = None
def create_player_weapon_stats(session=None, player=None,
- game=None, player_events=None):
+ game=None, pgstat=None, player_events=None):
pwstats = []
for (key,value) in player_events.items():
pwstat = PlayerWeaponStat()
pwstat.player_id = player.player_id
pwstat.game_id = game.game_id
+ pwstat.player_game_stat_id = pgstat.player_game_stat_id
pwstat.weapon_cd = weapon_cd
if 'n' in player_events:
# it and work on a new one (only set team info)
if len(player_events) != 0:
players.append(player_events)
+ player_events = {}
player_events[key] = value
return (game_meta, players)
+def create_player_stats(session=None, player=None, game=None,
+ player_events=None):
+ if 'joins' in player_events and 'matches' in player_events\
+ and 'scoreboardvalid' in player_events:
+ pgstat = create_player_game_stat(session=session,
+ player=player, game=game, player_events=player_events)
+ if not re.search('^bot#\d+$', player_events['P']):
+ create_player_weapon_stats(session=session,
+ player=player, game=game, pgstat=pgstat,
+ player_events=player_events)
+
+
@view_config(renderer='stats_submit.mako')
def stats_submit(request):
try:
has_real_players = False
for player_events in players:
+ log.debug(player_events['P'])
if not player_events['P'].startswith('bot'):
if 'joins' in player_events and 'matches' in player_events\
and 'scoreboardvalid' in player_events:
for player_events in players:
player = get_or_create_player(session=session,
hashkey=player_events['P'])
- if 'joins' in player_events and 'matches' in player_events\
- and 'scoreboardvalid' in player_events:
- pgstat = create_player_game_stat(session=session,
- player=player, game=game, player_events=player_events)
- if not player_events['P'].startswith('bot'):
- create_player_weapon_stats(session=session,
- player=player, game=game, player_events=player_events)
+ log.debug('Creating stats for %s' % player_events['P'])
+ create_player_stats(session=session, player=player, game=game,
+ player_events=player_events)
session.commit()
log.debug('Success! Stats recorded.')