Changeset 16914 for main


Ignore:
Timestamp:
9 Apr 2022, 17:50:09 (3 years ago)
Author:
Henrik Bettermann
Message:

A bit more computation-friendly.

File:
1 edited

Legend:

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

    r16904 r16914  
    7272                remark = 'nottaken'
    7373            ticket.remark = remark
     74            ticket.stdnt = level_obj.student
    7475            tickets.append(ticket)
    7576            allticketcodes.append(ticket.code)
     
    9091    # Remove failed or missed tickets if they have been passed later
    9192    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)
     93    for student in students:
     94        print student.student_id
     95        all_tickets = [i for i in tickets if student == i.stdnt]
     96        passed_tickets = [i for i in all_tickets if i.remark == 'passed']
     97        for passed_ticket in passed_tickets:
     98            for ticket in all_tickets:
     99                 if ticket.code == passed_ticket.code \
     100                    and ticket.remark != 'passed':
     101                    obsolete.append(ticket)
    102102    for ticket in set(obsolete):
    103103        tickets.remove(ticket)
Note: See TracChangeset for help on using the changeset viewer.