Returns the deserialized version of a single round.
(cur, round_num: int)
| 126 | return match |
| 127 | |
| 128 | def serialize_round(cur, round_num: int): |
| 129 | ''' |
| 130 | Returns the deserialized version of a single round. |
| 131 | ''' |
| 132 | t_round = {} |
| 133 | t_round['round'] = round_num |
| 134 | t_round['matches'] = [] |
| 135 | |
| 136 | cur.execute('SELECT MAX(index) FROM {} WHERE round=%s;'.format(TABLE_NAME), (round_num,)) |
| 137 | max_index = cur.fetchone()[0] |
| 138 | for index in range(0, max_index + 1): |
| 139 | match = serialize_match(cur, round_num, index) |
| 140 | if match is None: |
| 141 | continue |
| 142 | t_round['matches'].append(match) |
| 143 | |
| 144 | return t_round |
| 145 | |
| 146 | |
| 147 | def serialize_tournament(cur): |
no test coverage detected