Skip to content

Commit 3d27d89

Browse files
committed
Things go wrong when removing while iterating (statistics3)
1 parent c8c4940 commit 3d27d89

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

app/statistics3/statistics3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ def read_group(self, group: str, skip_debug: bool = True, start_time: datetime|N
6161
if start_time is not None:
6262
stmt = stmt.where(GroupAssignmentEvent.timeServer >= start_time)
6363

64-
65-
expected_pseudonyms: list[str] = list(session.scalars(stmt))
64+
loaded_pseudonyms: list[str] = list(session.scalars(stmt))
65+
expected_pseudonyms: list[str] = []
6666
valid_pseudonyms: list[str] = []
6767

68-
for pseudonym in expected_pseudonyms:
68+
for pseudonym in loaded_pseudonyms:
6969
try:
7070
player = session.get_one(Participant, pseudonym)
7171

7272
# Drop all players that have not started the game
7373
if not player.startedGame:
74-
expected_pseudonyms.remove(player.pseudonym)
7574
continue
76-
75+
76+
expected_pseudonyms.append(pseudonym)
7777
participant = self.read_participant(session, player)
7878
valid_pseudonyms.append(pseudonym)
7979
yield participant

0 commit comments

Comments
 (0)