Ignore:
Timestamp:
8 Feb 2017, 08:17:02 (8 years ago)
Author:
Henrik Bettermann
Message:

Customize signature fields. Fetch names from academic section.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students/reports
Files:
6 edited

Legend:

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

    r14489 r14517  
    1717##
    1818
     19import grok
    1920from waeup.kofa.students.reports.level_report import (
    2021    LevelReport, LevelReportGenerator)
     
    3132#"""
    3233
    33     signatures = [
    34         'Head of Department', 'Dean of Faculty']
     34    @property
     35    def signatures(self):
     36        site = grok.getSite()
     37        dean = site['faculties'][self.faccode].officer_1
     38        hod = site['faculties'][self.faccode][self.depcode].officer_1
     39        if not dean:
     40            dean = 'Dean of Faculty'
     41        if not hod:
     42            hod = 'Head of Department'
     43        return [hod, dean]
    3544
    3645class LevelReportGenerator(LevelReportGenerator):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/raw_score_report.py

    r14496 r14517  
    1717##
    1818
     19import grok
    1920from waeup.kofa.students.reports.raw_score_report import (
    2021    RawScoreReport, RawScoreReportGenerator)
     
    2324class CustomRawScoreReport(RawScoreReport):
    2425
    25     signatures = ['Head of Department', 'Dean of Faculty']
     26    @property
     27    def signatures(self):
     28        site = grok.getSite()
     29        dean = site['faculties'][self.faccode].officer_1
     30        hod = site['faculties'][self.faccode][self.depcode].officer_1
     31        if not dean:
     32            dean = 'Dean of Faculty'
     33        if not hod:
     34            hod = 'Head of Department'
     35        return [hod, dean]
    2636
    2737
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/session_results_presentation.py

    r14508 r14517  
    3131    @property
    3232    def introduction (self):
    33         site = grok.getSite()
    34         degrees_dict = getUtility(IKofaUtils).DEGREES_DICT
    35         if self.certcode == 'all':
    36             text = """I present to Senate, on behalf of the Faculty Board,
     33        text = """I present to Senate, on behalf of the Faculty Board,
    3734the results of courses taught and examinations held this academic session.
    3835The following candidate(s) have/have not satisfied the degree requirements
    39 of the Faculty and have/have not qualified for the award of an academic
    40 degree as stated below:
     36of the Faculty and have/have not qualified for the award of a degree as follows:
    4137"""
    42         else:
    43             certificate = site['faculties'][self.faccode][
    44                 self.depcode].certificates[self.certcode]
    45             degree = degrees_dict.get(certificate.degree, '[undefined]')
    46             text = """I present to Senate, on behalf of the Faculty Board,
    47 the results of courses taught and examinations held this academic session.
    48 The following candidate(s) have/have not satisfied the degree requirements
    49 of the Faculty and have/have not qualified for the award of a %s as stated
    50 below:
    51 """ % degree
    5238        return text
    5339
     
    5945#"""
    6046
    61     signatures = ['Head of Department', 'External Examiner', 'Dean of Faculty']
     47    @property
     48    def signatures(self):
     49        site = grok.getSite()
     50        dean = site['faculties'][self.faccode].officer_1
     51        hod = site['faculties'][self.faccode][self.depcode].officer_1
     52        examiner = site['faculties'][self.faccode][self.depcode].officer_2
     53        if not dean:
     54            dean = 'Dean of Faculty'
     55        if not hod:
     56            hod = 'Head of Department'
     57        if not examiner:
     58            examiner = 'External Examiner'
     59        return [hod, examiner, dean]
    6260
    6361class CustomSessionResultsPresentationGenerator(
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_level_report.py

    r14506 r14517  
    3636    def test_create_pdf(self):
    3737        self.student['studycourse']['100']['Course1'].ca = 0
     38        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine (Dean of Faculty)'
     39        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine (Head of Department)'
    3840        report = CustomLevelReport('fac1', 'dep1', 'CERT1', 2010, 100)
    3941        result = report.create_pdf('JOB_ID')
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_raw_score_report.py

    r14506 r14517  
    6161        self.app['faculties']['fac1']['dep1'].certificates[
    6262            'CERT1'].addCertCourse(self.course, level=100)
     63        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine (Dean of Faculty)'
     64        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine (Head of Department)'
    6365        studylevel = createObject('waeup.StudentStudyLevel')
    6466        studylevel.level = 200
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_session_results_presentation.py

    r14503 r14517  
    4242    def test_create_pdf(self):
    4343        self.certificate.degree = 'BA(FS)'
     44        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine (Dean of Faculty)'
     45        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine (Head of Department)'
     46        self.app['faculties']['fac1']['dep1'].officer_2 = 'Theresa Starbright (External Examiner)'
    4447        report = CustomSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
    4548        result = report.create_pdf('JOB_ID')
Note: See TracChangeset for help on using the changeset viewer.