Ignore:
Timestamp:
30 Nov 2017, 12:57:05 (7 years ago)
Author:
Henrik Bettermann
Message:

Many customizations are needed to distinguish Diploma and Non-Diploma students in reports.

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

Legend:

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

    r14632 r14918  
    8080        final_level_obj = level_obj.student['studycourse'][final_level]
    8181        if final_level_obj.remark not in (
    82             'Pass', '3s_rd_s', '2s_2_s', '2s_1_s', '1s_st_s'):
     82            'Pass', '3s_rd_s', '2s_2_s', '2s_1_s', '1s_st_s',
     83            'Merit', 'Credit', 'Distinction'):
    8384            return True
    8485        return False
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/session_results_presentation.py

    r14673 r14918  
    123123        final_level_obj = level_obj.student['studycourse'][final_level]
    124124        if final_level_obj.remark not in (
    125             'Pass', '3s_rd_s', '2s_2_s', '2s_1_s', '1s_st_s'):
     125            'Pass', '3s_rd_s', '2s_2_s', '2s_1_s', '1s_st_s',
     126            'Merit', 'Credit', 'Distinction'):
    126127            return True
    127128        return False
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_level_report.py

    r14629 r14918  
    8787        print "Sample grad_level_report.pdf written to %s" % path
    8888        return
     89
     90    def test_create_dp_pdf(self):
     91        self.certificate.study_mode = 'dp_ft'
     92        self.student['studycourse']['100']['Course1'].ca = 0
     93        self.student['studycourse']['100']['Course1'].credits = 91
     94        self.certificate.end_level = 100
     95        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine - Dean of Faculty'
     96        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine - Head of Department'
     97        report = GradLevelReport('fac1', 'dep1', 'CERT1', 2010, 100)
     98        result = report.create_pdf('JOB_ID')
     99        self.assertTrue(result.startswith('%PDF-'))
     100        path = os.path.join(samples_dir(), 'dp_grad_level_report.pdf')
     101        open(path, 'wb').write(result)
     102        print "Sample dp_grad_level_report.pdf written to %s" % path
     103        return
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_session_results_presentation.py

    r14631 r14918  
    5656        return
    5757
     58    def test_create_dp_pdf(self):
     59        self.certificate.degree = 'BA(FS)'
     60        self.certificate.study_mode = 'dp_ft'
     61        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine - Dean of Faculty'
     62        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine - Head of Department'
     63        self.app['faculties']['fac1']['dep1'].officer_2 = 'Theresa Starbright - External Examiner'
     64        report = CustomSessionResultsPresentation('fac1', 'dep1', 'CERT1', 2010, 100)
     65        result = report.create_pdf('JOB_ID')
     66        self.assertTrue(result.startswith('%PDF-'))
     67        path = os.path.join(samples_dir(), 'dp_session_results_presentation.pdf')
     68        open(path, 'wb').write(result)
     69        print "Sample dp_session_results_presentation.pdf written to %s" % path
     70        return
     71
    5872 
    5973class GradSessionResultsPresentationTests(CatalogTestSetup):
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r14675 r14918  
    186186        certificate = getattr(self.__parent__,'certificate',None)
    187187        end_level = getattr(certificate, 'end_level', None)
     188        study_mode = getattr(certificate, 'study_mode', None)
     189        is_dp = False
     190        if study_mode and study_mode.startswith('dp'):
     191            is_dp = True
    188192        failed_limit = 1.5
    189193        if self.student.entry_session < 2013:
     
    213217                return 'Fail'
    214218            if self.cumulative_params[0] < 1.5:
     219                if is_dp:
     220                    return 'Fail'
    215221                return 'Pass'
    216222            if self.cumulative_params[0] < 2.4:
     223                if is_dp:
     224                    return 'Pass'
    217225                return '3s_rd_s'
    218226            if self.cumulative_params[0] < 3.5:
     227                if is_dp:
     228                    return 'Merit'
    219229                return '2s_2_s'
    220230            if self.cumulative_params[0] < 4.5:
     231                if is_dp:
     232                    return 'Credit'
    221233                return '2s_1_s'
    222234            if self.cumulative_params[0] < 5.1:
     235                if is_dp:
     236                    return 'Distinction'
    223237                return '1s_st_s'
    224238            return 'N/A'
  • main/waeup.aaue/trunk/src/waeup/aaue/students/utils.py

    r14899 r14918  
    1818import grok
    1919from time import time
    20 from zope.component import createObject
     20from zope.component import createObject, queryUtility
     21from zope.catalog.interfaces import ICatalog
    2122from waeup.kofa.interfaces import (
    2223    ADMITTED, CLEARANCE, REQUESTED, CLEARED, RETURNING, PAID,
     
    3738    PORTRAIT_CHANGE_STATES = (ADMITTED,)
    3839
    39     gpa_boundaries_diploma = ((1.5, 'Fail'),
    40                               (1.5, 'Fail'),
    41                               (2.4, 'Pass'),
    42                               (3.5, 'Merit'),
    43                               (4.5, 'Credit'),
    44                               (5, 'Distinction'))
    45 
    46     gpa_boundaries = ((1, 'FRNS / NER / NYV'),
    47                       (1.5, 'Pass'),
    48                       (2.4, '3rd Class Honours (Diploma: Pass)'),
    49                       (3.5, '2nd Class Honours Lower Division (Diploma: Merit)'),
    50                       (4.5, '2nd Class Honours Upper Division (Diploma: Credit)'),
    51                       (5, '1st Class Honours (Diploma: Distinction)'))
     40    def GPABoundaries(self, faccode=None, depcode=None,
     41                            certcode=None, student=None):
     42        if student and student.current_mode.startswith('dp'):
     43            return ((1.5, 'Fail'),
     44                    (2.4, 'Pass'),
     45                    (3.5, 'Merit'),
     46                    (4.5, 'Credit'),
     47                    (5, 'Distinction'))
     48        elif student:
     49            return ((1, 'FRNS / NER / NYV'),
     50                    (1.5, 'Pass'),
     51                    (2.4, '3rd Class Honours'),
     52                    (3.5, '2nd Class Honours Lower Division'),
     53                    (4.5, '2nd Class Honours Upper Division'),
     54                    (5, '1st Class Honours'))
     55        # Session Results Presentations depend on certificate
     56        results = None
     57        if certcode:
     58            cat = queryUtility(ICatalog, name='certificates_catalog')
     59            results = list(
     60                cat.searchResults(code=(certcode, certcode)))
     61        if results and results[0].study_mode.startswith('dp'):
     62            return ((1.5, 'Fail'),
     63                    (2.4, 'Pass'),
     64                    (3.5, 'Merit'),
     65                    (4.5, 'Credit'),
     66                    (5, 'Distinction'))
     67        else:
     68            return ((1, 'FRNS / NER / NYV'),
     69                    (1.5, 'Pass'),
     70                    (2.4, '3rd Class Honours'),
     71                    (3.5, '2nd Class Honours Lower Division'),
     72                    (4.5, '2nd Class Honours Upper Division'),
     73                    (5, '1st Class Honours'))
    5274
    5375    def getClassFromCGPA(self, gpa, student):
    54         if student.current_mode.startswith('dp'):
    55             gpa_boundaries = self.gpa_boundaries_diploma
    56 
    57         else:
    58             gpa_boundaries = self.gpa_boundaries
     76        gpa_boundaries = self.GPABoundaries(student=student)
    5977        if gpa < gpa_boundaries[0][0]:
    6078            # FRNS / Fail
Note: See TracChangeset for help on using the changeset viewer.