Changeset 16865 for main


Ignore:
Timestamp:
8 Mar 2022, 08:32:56 (3 years ago)
Author:
Henrik Bettermann
Message:

Filter records.

File:
1 edited

Legend:

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

    r16859 r16865  
    1919"""
    2020import grok
     21from copy import deepcopy
    2122from zope.component import getUtility, createObject
    2223from waeup.kofa.utils.batching import ExporterBase
     
    4041    """
    4142    """
    42     tickets = []
     43    tickets = list()
    4344    #code = kw.get('code', None)
    4445    level = kw.get('level', None)
     
    4950    allticketcodes = list()
    5051    for level_obj in get_levels(students, previous, **kw):
    51 
    52 
    5352        for ticket in level_obj.values():
    5453            if ct_level not in ('all', None):
     
    8988                    ticket.stdnt = level_obj.student
    9089                    tickets.append(ticket)
     90    # Remove failed or missed tickets if they have been passed later
     91    obsolete = list()
     92    passed_tickets = [i for i in tickets if i.remark == 'passed']
     93    for passed_ticket in passed_tickets:
     94        for ticket in tickets:
     95            student = ticket.student
     96            if not student:
     97                student = ticket.stdnt  # missed ticket
     98            if student == passed_ticket.student \
     99                and ticket.code == passed_ticket.code \
     100                and ticket.remark != 'passed':
     101                obsolete.append(ticket)
     102    for ticket in obsolete:
     103        tickets.remove(ticket)
    91104    return tickets
    92105
Note: See TracChangeset for help on using the changeset viewer.