Ignore:
Timestamp:
8 Feb 2017, 07:56:05 (8 years ago)
Author:
Henrik Bettermann
Message:

Harmonize student level statistics report.

File:
1 edited

Legend:

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

    r14374 r14516  
    7474    cat = queryUtility(ICatalog, name="students_catalog")
    7575    result = cat.searchResults(current_session=(session, session))
    76     table = [[0 for x in xrange(2 * len(levels) + 2)] for y in xrange(len(paths)+1)]
     76    table = [[0 for x in xrange(2 * len(levels) + 2)]
     77             for y in xrange(len(paths)+1)]
    7778    mode_groups = getUtility(IKofaUtils).MODE_GROUPS
    7879    for stud in result:
    79         if mode != 'All' and stud.current_mode not in mode_groups[mode]:
     80        if mode != 'All' and stud.current_mode \
     81            and stud.current_mode not in mode_groups[mode]:
    8082            continue
    8183        if getattr(stud, breakdown) is None:
     
    177179        creator = getUtility(IPDFCreator, name='landscape')
    178180        table_data = tbl_data_to_table(*self.data)
    179         col_widths = [None,] + [1.8*cm] * (len(self.data[1]) - 1)+ [2.0*cm] + [None,]
     181        col_widths = [None,] + [1.8*cm] * (
     182            len(self.data[1]) - 1)+ [2.0*cm] + [None,]
    180183        pdf_data = [Paragraph('<b>%s - Report %s</b>'
    181184                              % (self.creation_dt_string, job_id),
    182185                              STYLE["Normal"]),
    183186                    Spacer(1, 12),]
     187        pdf_data += [Paragraph(
     188                    translate(
     189                        'Study Mode: ${a}<br />'
     190                        'Academic Session: ${b}',
     191                        mapping = {'a':self.mode,
     192                                   'b':self.session,
     193                                   }),
     194                    STYLE["Normal"]),
     195                    Spacer(1, 12),]
    184196        pdf_data += [
    185197            Table(table_data, style=TABLE_STYLE, colWidths=col_widths)]
    186         doc_title = translate(
    187             _('${a} Students - ${c}',
    188             mapping = {'a':self.mode, 'c':self.session}))
     198        doc_title = translate(_('Student Level Statistics'))
    189199        pdf = creator.create_pdf(
    190             pdf_data, None, doc_title, self.author, doc_title + ' -'
     200            pdf_data, None, doc_title, self.author,
     201            doc_title + ' - %s -' % self.session,
    191202            )
    192203        return pdf
     
    249260            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    250261            grok.getSite().logger.info(
    251                 '%s - report %s created: %s (session=%s, mode=%s, breakdown=%s)' % (
     262                '%s - report %s created: %s '
     263                '(session=%s, mode=%s, breakdown=%s)' % (
    252264                ob_class, job_id, self.context.title,
    253265                session, mode, breakdown))
     
    278290
    279291    def _filename(self):
    280         return 'StudentLevelStatisticsReport_%s_%s_%s.pdf' % (
    281             self.context.session, self.context.mode,
     292        return 'StudentLevelStatisticsReport_rno%s_%s.pdf' % (
     293            self.context.__name__,
    282294            self.context.creation_dt_string)
    283295
Note: See TracChangeset for help on using the changeset viewer.