Last Seen: <small>${recent_games[0][1].fuzzy_date()} </small><br />
% if fav_server is not None:
- Favorite Server: <small>
- <% srv_list = fav_server[:1] %>
+ Favorite Servers: <small>
+ <% srv_list = fav_server[:3] %>
% for srvinfo in srv_list:
% if srvinfo != srv_list[-1]:
<% delim = ", " %>
</div>
<div class="span6">
<p>
- Playing Time: <small>${total_stats['alivetime']} hours
- % if total_stats['alivetime'] > total_stats['alivetime_month']:
- % if total_stats['alivetime_month'] > total_stats['alivetime_week']:
- (${total_stats['alivetime_month']} hours this month; ${total_stats['alivetime_week']} hours this week)
+ Playing Time: <small>${total_stats['alivetime']}
+ % if total_stats['alivetime_month'] and total_stats['alivetime'] > total_stats['alivetime_month']:
+ % if total_stats['alivetime_week'] and total_stats['alivetime_month'] > total_stats['alivetime_week']:
+ <br />(${total_stats['alivetime_month']} this month; ${total_stats['alivetime_week']} this week)
% else:
- (${total_stats['alivetime_month']} hours this month)
+ <br />(${total_stats['alivetime_month']} this month)
% endif
% endif
</small><br />
<% games_breakdown_str = ', '.join(["{0} {1}".format(ng, gt) for (gt, ng) in total_stats['games_breakdown'].items()]) %>
- Games Played: <small>${total_stats['games']} (${games_breakdown_str})</small><br />
+ Games Played: <small>${total_stats['games']}<br />(${games_breakdown_str})</small><br />
% if total_stats['games'] > 0 and total_stats['wins'] is not None:
Win Percentage: <small>${round(float(total_stats['wins'])/total_stats['games'] * 100, 2)}% (${total_stats['wins']} wins, ${total_stats['games'] - total_stats['wins']} losses) </small><br />
</div>
<div class="row">
- <div class="span11">
+ <div class="span12">
<p>
% if total_stats['games_breakdown'].has_key('duel'):
Duel Stats: <small>
filter(PlayerGameStat.player_id == player_id).\
filter(Game.winner == PlayerGameStat.team or PlayerGameStat.rank == 1).\
one()
-
+
(total_stats['duel_wins'],) = DBSession.query(
func.count("*")).\
filter(Game.game_id == PlayerGameStat.game_id).\
(total_stats['dm_wins'],) = DBSession.query(
func.count("*")).\
filter(Game.game_id == PlayerGameStat.game_id).\
- filter(Game.game_type_cd == "dm" or Game.game_type_cd == "tdm").\
+ filter(Game.game_type_cd == "dm").\
filter(PlayerGameStat.player_id == player_id).\
filter(PlayerGameStat.rank == 1).\
one()
func.sum(PlayerGameStat.deaths),
func.sum(PlayerGameStat.suicides)).\
filter(Game.game_id == PlayerGameStat.game_id).\
- filter(Game.game_type_cd == "dm" or Game.game_type_cd == "tdm").\
+ filter(Game.game_type_cd == "dm").\
filter(PlayerGameStat.player_id == player_id).\
one()
+ (total_stats['tdm_kills'], total_stats['tdm_deaths'], total_stats['tdm_suicides'],) = DBSession.query(
+ func.sum(PlayerGameStat.kills),
+ func.sum(PlayerGameStat.deaths),
+ func.sum(PlayerGameStat.suicides)).\
+ filter(Game.game_id == PlayerGameStat.game_id).\
+ filter(Game.game_type_cd == "tdm").\
+ filter(PlayerGameStat.player_id == player_id).\
+ one()
+
+ (total_stats['tdm_wins'],) = DBSession.query(
+ func.count("*")).\
+ filter(Game.game_id == PlayerGameStat.game_id).\
+ filter(Game.game_type_cd == "tdm").\
+ filter(PlayerGameStat.player_id == player_id).\
+ filter(PlayerGameStat.rank == 1).\
+ one()
+
(total_stats['ctf_wins'],) = DBSession.query(
func.count("*")).\
filter(Game.game_id == PlayerGameStat.game_id).\
filter(PlayerGameStat.create_dt > back_then).\
group_by(Map.name, Map.map_id).\
order_by(func.count().desc()).\
- all()
+ limit(5).all()
fav_map = []
for map_e in raw_fav_map:
back_then = datetime.datetime.utcnow() - datetime.timedelta(days=90)
raw_fav_weapon = DBSession.query(Weapon.descr, Weapon.weapon_cd).\
- filter(Game.game_id == PlayerGameStat.game_id).\
+ filter(Game.game_id == PlayerWeaponStat.game_id).\
+ filter(PlayerWeaponStat.player_id == player_id).\
filter(PlayerWeaponStat.weapon_cd == Weapon.weapon_cd).\
- filter(PlayerGameStat.player_id == player_id).\
- filter(PlayerGameStat.create_dt > back_then).\
+ filter(PlayerWeaponStat.create_dt > back_then).\
group_by(Weapon.descr, Weapon.weapon_cd).\
order_by(func.count().desc()).\
- all()
+ limit(5).all()
fav_weapon = []
for wpn_e in raw_fav_weapon:
filter(PlayerGameStat.create_dt > back_then).\
group_by(Server.name, Server.server_id).\
order_by(func.count().desc()).\
- all()
+ limit(5).all()
fav_server = []
for srv_e in raw_fav_server: