Ignore:
Timestamp:
13 Oct 2021, 07:10:12 (3 years ago)
Author:
Henrik Bettermann
Message:

Make deepcopy first before removing items from the list. Otherwise items will be skipped in the for loop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r16666 r16679  
    2020import os
    2121import grok
     22from copy import deepcopy
    2223from datetime import datetime, timedelta
    2324from zope.component import getUtility
     
    155156            for level in student['studycourse'].values():
    156157                # check if already failed or not taken courses have been passed later
    157                 for code in failedticketcodes:
    158                     if code in level.passed_params[6]:
     158                failedticketcodes_copy = deepcopy(failedticketcodes)
     159                nottakenticketcodes_copy = deepcopy(nottakenticketcodes)
     160                for code in failedticketcodes_copy:
     161                    if code.strip('m_').strip('_m') in level.passed_params[6]:
    159162                        failedticketcodes.remove(code)
    160                 for code in nottakenticketcodes:
     163                for code in nottakenticketcodes_copy:
    161164                    if code in level.passed_params[6]:
    162165                        nottakenticketcodes.remove(code)
Note: See TracChangeset for help on using the changeset viewer.