Changeset 10251


Ignore:
Timestamp:
30 May 2013, 11:53:33 (12 years ago)
Author:
Henrik Bettermann
Message:

Render course ticket tables correctly.

File:
1 edited

Legend:

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

    r10250 r10251  
    209209    """
    210210    data = []
    211     line = []
    212211    style = getSampleStyleSheet()
    213212
    214213    for level in levels_data:
    215214        level_obj = level['level']
     215        tickets = level['tickets_1'] + level['tickets_2'] + level['tickets_3']
     216        headerline = []
     217        tabledata = []
    216218        subheader = 'Session %s, Level %s' % (
    217219            view.session_dict[level_obj.level_session],
    218220            view.course_levels.getTerm(level_obj.level).title)
    219221        data.append(Paragraph(subheader, HEADING_STYLE))
    220 
    221         tabledata = []
    222222        for element in tableheader:
    223223            field = '<strong>%s</strong>' % formatted_text(element[0])
    224224            field = Paragraph(field, style["Normal"])
    225             line.append(field)
    226         tabledata.append(line)
    227         tickets = []
    228         tickets += level['tickets_1']
    229         tickets += level['tickets_2']
    230         tickets += level['tickets_3']
     225            headerline.append(field)
     226        tabledata.append(headerline)
    231227        for ticket in tickets:
    232             line = []
     228            ticketline = []
    233229            for element in tableheader:
    234230                  field = formatted_text(getattr(ticket,element[1],u' '))
    235231                  field = Paragraph(field, style["Normal"])
    236                   line.append(field)
    237             tabledata.append(line)
     232                  ticketline.append(field)
     233            tabledata.append(ticketline)
    238234        table = Table(tabledata,colWidths=[
    239235            element[2]*cm for element in tableheader], style=CONTENT_STYLE)
Note: See TracChangeset for help on using the changeset viewer.