Ignore:
Timestamp:
11 Sep 2013, 05:47:55 (11 years ago)
Author:
Henrik Bettermann
Message:

Sort on matric number and replace student id be serial number.

File:
1 edited

Legend:

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

    r10579 r10615  
    5656            continue
    5757        passed_params = level_obj.passed_params
    58         line = (stud.student_id,
     58        line = (
     59                #stud.student_id,
    5960                stud.matric_number,
    6061                stud.display_fullname,
     
    6566                )
    6667        table.append(line)
    67     return table
     68    return sorted(table, key=lambda value:value[1])
    6869
    6970from reportlab.lib import colors
     
    9798def tbl_data_to_table(data):
    9899    result = []
    99     col_names = ('Student Id', 'Matric No.', 'Name',
    100                      TTR('Total Credits'), TTR('Total Credits Passed'),
    101                      TTR('GPA'), 'Courses Failed')
     100    col_names = (
     101            #'Student Id',
     102            'S/N',
     103            'Matric No.',
     104            'Name',
     105            TTR('Total Credits'),
     106            TTR('Total Credits Passed'),
     107            TTR('GPA'),
     108            'Courses Failed')
    102109    table = [col_names]
     110    sn = 1
    103111    for line in data:
     112        line = (sn,) + line
    104113        table.append(line)
     114        sn += 1
    105115    return table
    106116
     
    112122    #('FONT', (-1,0), (-1,-1), 'Helvetica-Bold', 8), # last column
    113123    ('ALIGN', (3,1), (-1,-1), 'RIGHT'),
    114     #('ALIGN', (1,0), (1,-1), 'LEFT'),
    115     #('ALIGN', (2,0), (2,-1), 'LEFT'),
     124    ('ALIGN', (0,0), (0,-1), 'RIGHT'),
    116125    ('ALIGN', (6,0), (6,-1), 'LEFT'),
    117126    ('INNERGRID', (0,1), (-1,-1), 0.25, colors.black),
     
    148157        table_data = tbl_data_to_table(self.data)
    149158        #col_widths = [3.5*cm] * len(self.data[0])
    150         col_widths = [2*cm, 4*cm, 5*cm, 0.8*cm, 0.8*cm, 0.8*cm, 6*cm, ]
     159        col_widths = [1*cm, 4*cm, 5*cm, 0.8*cm, 0.8*cm, 0.8*cm, 6*cm, ]
    151160        pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
    152161                              STYLE["Normal"]),
Note: See TracChangeset for help on using the changeset viewer.