Ignore:
Timestamp:
6 Jan 2017, 22:40:30 (8 years ago)
Author:
Henrik Bettermann
Message:

Show report number (job_id) on report pdf slips.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
10 edited

Legend:

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

    r12901 r14373  
    4444        """not when any output was created.""")
    4545
    46     def create_pdf():
     46    def create_pdf(job_id):
    4747        """Generate a PDF copy.
    4848        """
     
    190190        self.creation_dt = now()
    191191
    192     def create_pdf(self):
     192    def create_pdf(self, job_id):
    193193        raise NotImplementedError()
    194194
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/level_report.py

    r14372 r14373  
    185185        self.data = get_students(faccode, depcode, session, level)
    186186
    187     def create_pdf(self):
     187    def create_pdf(self, job_id):
    188188        creator = getUtility(IPDFCreator, name='landscape')
    189189        table_data = tbl_data_to_table(self.data)
     
    191191        col_widths = [1*cm, 4*cm, 5*cm, 0.8*cm, 0.8*cm, 0.8*cm, 1*cm,
    192192                      6*cm, 0.8*cm, 0.8*cm, 1*cm, 2*cm]
    193         pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
     193        pdf_data = [Paragraph('<b>%s - Report %s</b>'
     194                              % (self.creation_dt_string, job_id),
    194195                              STYLE["Normal"]),
    195196                    Spacer(1, 12),]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/session_results_presentation.py

    r14269 r14373  
    143143        self.data = get_students(faccode, depcode, session, level)
    144144
    145     def create_pdf(self):
     145    def create_pdf(self, job_id):
    146146        creator = getUtility(IPDFCreator)
    147147        #col_widths = [2*cm, 4*cm, 5*cm, 0.8*cm, 0.8*cm, 0.8*cm, 6*cm, ]
    148         pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
     148        pdf_data = [Paragraph('<b>%s - Report %s</b>'
     149                              % (self.creation_dt_string, job_id),
    149150                              STYLE["Normal"]),
    150151                    Spacer(1, 12),]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_payment_statistics.py

    r12897 r14373  
    200200        self.data = get_student_payment_stats(session, mode, level, breakdown)
    201201
    202     def create_pdf(self):
     202    def create_pdf(self, job_id):
    203203        creator = getUtility(IPDFCreator, name='landscape')
    204204        table_data = tbl_data_to_table(*self.data)
    205205        col_widths = [None,] + [3.2*cm] * len(self.data[1]) + [None,]
    206         pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
     206        pdf_data = [Paragraph('<b>%s - Report %s</b>'
     207                              % (self.creation_dt_string, job_id),
    207208                              STYLE["Normal"]),
    208209                    Spacer(1, 12),]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/student_statistics.py

    r13236 r14373  
    161161        self.data = get_student_stats(session, mode, level, breakdown)
    162162
    163     def create_pdf(self):
     163    def create_pdf(self, job_id):
    164164        creator = getUtility(IPDFCreator, name='landscape')
    165165        table_data = tbl_data_to_table(*self.data)
    166166        col_widths = [None,] + [1.6*cm] * len(self.data[1]) + [None,]
    167         pdf_data = [Paragraph('<b>%s</b>' % self.creation_dt_string,
     167        pdf_data = [Paragraph('<b>%s - Report %s</b>'
     168                              % (self.creation_dt_string, job_id),
    168169                              STYLE["Normal"]),
    169170                    Spacer(1, 12),]
     
    296297        self.response.setHeader(
    297298            'Content-Disposition:', 'attachment; filename="%s' % filename)
    298         pdf_stream = self.context.create_pdf()
     299        pdf_stream = self.context.create_pdf(self.context.__name__)
    299300        ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
    300301        grok.getSite().logger.info('%s - report %s downloaded: %s' % (
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_level_report.py

    r14372 r14373  
    6363        self.student['studycourse']['100']['Course3'] = ticket
    6464        report = LevelReport('fac1', 'dep1', 2010, 100)
    65         result = report.create_pdf()
     65        result = report.create_pdf('JOB_ID')
    6666        self.assertTrue(result.startswith('%PDF-'))
    6767        path = os.path.join(samples_dir(), 'level_report.pdf')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_session_results_presentation.py

    r12898 r14373  
    6363    def test_create_pdf(self):
    6464        report = SessionResultsPresentation('fac1', 'dep1', 2010, 100)
    65         result = report.create_pdf()
     65        result = report.create_pdf('JOB_ID')
    6666        self.assertTrue(result.startswith('%PDF-'))
    6767        path = os.path.join(samples_dir(), 'session_results_presentation.pdf')
     
    8181        self.student['studycourse']['620']['Course2'] = ticket
    8282        report = SessionResultsPresentation('fac1', 'dep1', 2013, 620)
    83         result = report.create_pdf()
     83        result = report.create_pdf('JOB_ID')
    8484        self.assertTrue(result.startswith('%PDF-'))
    8585        path = os.path.join(samples_dir(), 'session_results_presentation_620.pdf')
     
    102102        self.student['studycourse']['200']['Course2'] = ticket
    103103        report = SessionResultsPresentation('fac1', 'dep1', 2010, 0)
    104         result = report.create_pdf()
     104        result = report.create_pdf('JOB_ID')
    105105        self.assertTrue(result.startswith('%PDF-'))
    106106        path = os.path.join(samples_dir(), 'session_results_presentation_erroneous.pdf')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_payment_statistics.py

    r12897 r14373  
    5656        report = StudentPaymentStatisticsReport(
    5757            2010, 'Undergraduate Full-Time', 0,  'faccode')
    58         result = report.create_pdf()
     58        result = report.create_pdf('JOB_ID')
    5959        self.assertTrue(result.startswith('%PDF-'))
    6060        path = os.path.join(samples_dir(), 'student_payment_statistics.pdf')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/reports/tests/test_student_statistics.py

    r14169 r14373  
    120120        report = StudentStatisticsReport(
    121121            2010, 'Undergraduate Full-Time', 0, 'faccode')
    122         result = report.create_pdf()
     122        result = report.create_pdf('JOB_ID')
    123123        self.assertTrue(result.startswith('%PDF-'))
    124124        path = os.path.join(samples_dir(), 'student_statistics.pdf')
     
    131131        report = StudentStatisticsReport(
    132132            2010, 'Undergraduate Full-Time', 100, 'faccode')
    133         result = report.create_pdf()
     133        result = report.create_pdf('JOB_ID')
    134134        self.assertTrue(result.startswith('%PDF-'))
    135135        path = os.path.join(samples_dir(), 'student_statistics_100.pdf')
  • main/waeup.kofa/trunk/src/waeup/kofa/tests/test_reports.py

    r12110 r14373  
    7272        # trying to create a pdf results in an error
    7373        report = Report()
    74         self.assertRaises(NotImplementedError, report.create_pdf)
     74        self.assertRaises(NotImplementedError, report.create_pdf, 'JOB_ID')
    7575        return
    7676
Note: See TracChangeset for help on using the changeset viewer.