\r
log = logging.getLogger(__name__)\r
\r
+\r
+def has_minimum_real_players(player_events):\r
+ """\r
+ Determines if the collection of player events has enough "real" players\r
+ to store in the database. The minimum setting comes from the config file\r
+ under the setting xonstat.minimum_real_players.\r
+ """\r
+ flg_has_min_real_players = True\r
+\r
+ real_players = 0\r
+ for events in player_events:\r
+ if is_real_player(events):\r
+ real_players += 1\r
+\r
+ #TODO: put this into a config setting in the ini file?\r
+ if real_players < 1:\r
+ flg_has_min_real_players = False\r
+\r
+ return flg_has_min_real_players\r
+\r
+\r
def has_required_metadata(metadata):\r
"""\r
Determines if a give set of metadata has enough data to create a game,\r
"Can't continue.")\r
raise Exception("Required game meta fields (T, G, M, or S) missing.")\r
\r
- real_players = 0\r
- for events in players:\r
- if is_real_player(events):\r
- real_players += 1\r
-\r
- #TODO: put this into a config setting in the ini file?\r
- if real_players < 1:\r
+ if not has_minimum_real_players(players):\r
raise Exception("The number of real players is below the minimum. "\\r
"Stats will be ignored.")\r
\r