except:
minimum_required_players = 2
+ # Make an exception for CTS since it can be done by individuals and there is no Elo anyway
+ if submission.game_type_cd == "cts":
+ minimum_required_players = 1
+
return len(submission.humans) >= minimum_required_players
return game_type_cd not in {'cts'}
+def should_do_frag_matrix(game_type_cd):
+ """True if the game type should record frag matrix values. False otherwise."""
+ return game_type_cd in {
+ 'as', 'ca', 'ctf', 'dm', 'dom', 'ft', 'freezetag', 'ka', 'kh', 'rune', 'tdm',
+ }
+
+
def gametype_elo_eligible(game_type_cd):
"""True of the game type should process Elos. False otherwise."""
return game_type_cd in {'duel', 'dm', 'ca', 'ctf', 'tdm', 'ka', 'ft'}
game.mod = mod[:64]
# There is some drift between start_dt (provided by app) and create_dt
- # (default in the database), so we'll make them the same until this is
+ # (default in the database), so we'll make them the same until this is
# resolved.
game.create_dt = start_dt
if game_type_cd in 'ca' 'dm' 'duel' 'rune' 'tdm':
pgstat.kills = pgstat.deaths = pgstat.suicides = 0
- if game_type_cd == 'cq':
- pgstat.kills = pgstat.deaths = pgstat.suicides = pgstat.captures = 0
- pgstat.drops = 0
-
if game_type_cd == 'ctf':
pgstat.kills = pgstat.captures = pgstat.pickups = pgstat.drops = 0
pgstat.returns = pgstat.carrier_frags = 0
pgstat.captures = pgstat.drops = pgstat.pushes = pgstat.destroys = 0
pgstat.carrier_frags = 0
- if game_type_cd == 'lms':
- pgstat.kills = pgstat.deaths = pgstat.suicides = pgstat.lives = 0
-
if game_type_cd == 'nb':
pgstat.kills = pgstat.deaths = pgstat.suicides = pgstat.captures = 0
pgstat.drops = 0
- if game_type_cd == 'rc':
- pgstat.kills = pgstat.deaths = pgstat.suicides = pgstat.laps = 0
-
return pgstat
# all team game modes have a score, so we'll zero that out always
teamstat.score = 0
- if game_type_cd in 'ca' 'ft' 'lms' 'ka':
+ if game_type_cd in 'ca' 'ft' 'ka':
teamstat.rounds = 0
if game_type_cd == 'ctf':
pgstat = create_game_stat(session, game, gmap, player, events)
pgstats.append(pgstat)
- frag_matrix = create_frag_matrix(session, submission.player_indexes, pgstat, events)
+ if should_do_frag_matrix(submission.game_type_cd):
+ create_frag_matrix(session, submission.player_indexes, pgstat, events)
# player ranking opt-out
- if 'r' in events and events['r'] != '0':
+ if 'r' in events and events['r'] == '0':
+ log.debug("Excluding player {} from ranking calculations (opt-out)"
+ .format(pgstat.player_id))
+ else:
elo_pgstats.append(pgstat)
if player.player_id > 1: