Skip to content

Commit

Permalink
[FIX] make changes processing code more obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
huguesdk committed Oct 29, 2024
1 parent a1d1d9f commit d175911
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions beesdoo_shift_swap/models/planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ def _prepare_task_day(self):

swap_subscription_done = []
for shift in shifts:
for rec in list(changes):
to_process = changes
changes = []
for rec in to_process:
shift, swap_subscription_done, done = rec.update_shift_data(
shift, swap_subscription_done
)
if done:
# You're not supposed to remove items from a list while
# looping over it. We circumvent this problem by looping
# over a copy of the list, which will not be affected.
changes.remove(rec)
if not done:
changes.append(rec)

return shifts

0 comments on commit d175911

Please sign in to comment.