if player_id is not None:
if force_player_id:
recent_games_q = recent_games_q.\
- filter(PlayerGameStat.player_id==player_id)
+ filter(PlayerGameStat.player_id==player_id).\
+ filter(Game.players.contains([player_id]))
else:
recent_games_q = recent_games_q.\
filter(PlayerGameStat.scoreboardpos==1).\
filter(Game.game_id==pgstat_alias.game_id).\
+ filter(Game.players.contains([player_id])).\
filter(pgstat_alias.player_id==player_id)
else:
recent_games_q = recent_games_q.\
"FROM games g, "
"player_game_stats pgs "
"WHERE g.game_id = pgs.game_id "
- "AND pgs.player_id = :player_id) win_loss "
+ "AND pgs.player_id = :player_id "
+ "AND g.players @> ARRAY[:player_id]) win_loss "
"GROUP BY game_type_cd "
).params(player_id=player_id).all()
"player_game_stats pgs "
"WHERE g.game_id = pgs.game_id "
"AND g.game_type_cd = gt.game_type_cd "
+ "AND g.players @> ARRAY[:player_id] "
"AND pgs.player_id = :player_id "
"GROUP BY g.game_type_cd, game_type_descr "
"UNION "
"maps m "
"WHERE g.game_id = pgs.game_id "
"AND g.map_id = m.map_id "
+ "AND g.players @> ARRAY[:player_id]"
"AND pgs.player_id = :player_id "
"GROUP BY g.game_type_cd, "
"m.map_id, "