2.0.0-rc1 : Profile and achievements update.
This commit is contained in:
@@ -246,12 +246,19 @@ class IntegrityService:
|
||||
@staticmethod
|
||||
def _check_l3(db, roster_ids, checks, counts):
|
||||
required_tables = {
|
||||
'dm_duo_stats',
|
||||
'dm_match_player_reports',
|
||||
'dm_match_reports',
|
||||
'dm_player_features',
|
||||
'dm_player_awards',
|
||||
'dm_player_match_history',
|
||||
'dm_player_map_stats',
|
||||
'dm_player_period_stats',
|
||||
'dm_player_record_events',
|
||||
'dm_player_records',
|
||||
'dm_player_weapon_stats',
|
||||
'dm_lineup_stats',
|
||||
'dm_team_season_stats',
|
||||
}
|
||||
missing = sorted(required_tables - IntegrityService._table_names(db))
|
||||
IntegrityService._check(
|
||||
@@ -281,6 +288,42 @@ class IntegrityService:
|
||||
counts['l3_records'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_player_records'
|
||||
).fetchone()[0]
|
||||
counts['l3_duos'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_duo_stats'
|
||||
).fetchone()[0]
|
||||
counts['l3_lineups'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_lineup_stats'
|
||||
).fetchone()[0]
|
||||
counts['l3_match_reports'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_match_reports'
|
||||
).fetchone()[0]
|
||||
counts['l3_player_reports'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_match_player_reports'
|
||||
).fetchone()[0]
|
||||
counts['l3_record_events'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_player_record_events'
|
||||
).fetchone()[0]
|
||||
counts['l3_seasons'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_team_season_stats'
|
||||
).fetchone()[0]
|
||||
counts['l3_awards'] = db.execute(
|
||||
'SELECT COUNT(*) FROM dm_player_awards'
|
||||
).fetchone()[0]
|
||||
expected_matches = counts.get('matches', 0)
|
||||
IntegrityService._check(
|
||||
checks,
|
||||
'Post-match report coverage',
|
||||
(
|
||||
'pass'
|
||||
if counts['l3_match_reports'] == expected_matches
|
||||
else 'fail'
|
||||
),
|
||||
(
|
||||
f"{counts['l3_match_reports']}/"
|
||||
f"{expected_matches} matches reported"
|
||||
),
|
||||
counts['l3_match_reports'],
|
||||
)
|
||||
|
||||
if roster_ids:
|
||||
placeholders = ','.join('?' for _ in roster_ids)
|
||||
@@ -323,6 +366,21 @@ class IntegrityService:
|
||||
f'{actual_history}/{expected_history} player-match rows materialized',
|
||||
actual_history,
|
||||
)
|
||||
player_report_count = db.execute(
|
||||
f"""
|
||||
SELECT COUNT(*)
|
||||
FROM dm_match_player_reports
|
||||
WHERE steam_id_64 IN ({placeholders})
|
||||
""",
|
||||
roster_ids,
|
||||
).fetchone()[0]
|
||||
IntegrityService._check(
|
||||
checks,
|
||||
'Roster player-report completeness',
|
||||
'pass' if player_report_count == expected_history else 'fail',
|
||||
f'{player_report_count}/{expected_history} player reports',
|
||||
player_report_count,
|
||||
)
|
||||
|
||||
score_rows = db.execute(
|
||||
f"""
|
||||
@@ -378,6 +436,13 @@ class IntegrityService:
|
||||
('l3_weapons', 'Player weapon stats mart'),
|
||||
('l3_periods', 'Player period stats mart'),
|
||||
('l3_records', 'Player records mart'),
|
||||
('l3_duos', 'Team duo stats mart'),
|
||||
('l3_lineups', 'Team lineup stats mart'),
|
||||
('l3_match_reports', 'Post-match report mart'),
|
||||
('l3_player_reports', 'Player post-match report mart'),
|
||||
('l3_record_events', 'Record event mart'),
|
||||
('l3_seasons', 'Team season mart'),
|
||||
('l3_awards', 'Player award mart'),
|
||||
):
|
||||
value = counts[key]
|
||||
IntegrityService._check(
|
||||
@@ -424,6 +489,8 @@ class IntegrityService:
|
||||
'schema_migrations',
|
||||
'strategy_boards',
|
||||
'team_lineups',
|
||||
'team_roster_members',
|
||||
'team_roster_versions',
|
||||
'wiki_pages',
|
||||
}
|
||||
missing = sorted(required_tables - IntegrityService._table_names(db))
|
||||
@@ -509,3 +576,42 @@ class IntegrityService:
|
||||
f'{active_count} active lineups configured',
|
||||
active_count,
|
||||
)
|
||||
|
||||
current_versions = db.execute(
|
||||
"""
|
||||
SELECT id
|
||||
FROM team_roster_versions
|
||||
WHERE is_current = 1
|
||||
"""
|
||||
).fetchall()
|
||||
current_member_count = 0
|
||||
if len(current_versions) == 1:
|
||||
current_member_count = db.execute(
|
||||
"""
|
||||
SELECT COUNT(*)
|
||||
FROM team_roster_members
|
||||
WHERE roster_version_id = ?
|
||||
""",
|
||||
[current_versions[0]['id']],
|
||||
).fetchone()[0]
|
||||
counts['roster_versions'] = db.execute(
|
||||
'SELECT COUNT(*) FROM team_roster_versions'
|
||||
).fetchone()[0]
|
||||
counts['current_roster_members'] = current_member_count
|
||||
IntegrityService._check(
|
||||
checks,
|
||||
'Current roster version',
|
||||
'pass' if len(current_versions) == 1 else 'fail',
|
||||
f'{len(current_versions)} current roster versions',
|
||||
len(current_versions),
|
||||
)
|
||||
IntegrityService._check(
|
||||
checks,
|
||||
'Roster version membership',
|
||||
'pass' if current_member_count == counts.get('active_roster', 0) else 'fail',
|
||||
(
|
||||
f"{current_member_count}/"
|
||||
f"{counts.get('active_roster', 0)} active members versioned"
|
||||
),
|
||||
current_member_count,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user