Fill in TEAM_ID_TO_NAME and TEAM_ID_TO_AVATAR with the information of all teams that have submitted a robot.
(cur)
| 44 | DEFAULT_AVATAR = AVATAR_PREFIX + 'default.png' |
| 45 | |
| 46 | def index_team_info(cur) -> None: |
| 47 | ''' |
| 48 | Fill in TEAM_ID_TO_NAME and TEAM_ID_TO_AVATAR with the information of all |
| 49 | teams that have submitted a robot. |
| 50 | ''' |
| 51 | query = 'SELECT DISTINCT teams.id, teams.name, teams.avatar \ |
| 52 | FROM battlecode_teams teams INNER JOIN scrimmage_submissions subs \ |
| 53 | ON teams.id = subs.team;' |
| 54 | cur.execute(query); |
| 55 | |
| 56 | teams = cur.fetchall() |
| 57 | for team_id, name, avatar in teams: |
| 58 | TEAM_ID_TO_NAME[team_id] = name |
| 59 | if avatar is None: |
| 60 | TEAM_ID_TO_AVATAR[team_id] = DEFAULT_AVATAR |
| 61 | else: |
| 62 | TEAM_ID_TO_AVATAR[team_id] = AVATAR_PREFIX + re.search('/(\d+\..+)$', avatar).group(1) |
| 63 | |
| 64 | |
| 65 | def serialize_team(team_id): |
no outgoing calls
no test coverage detected