Ignore:
Timestamp:
24 Aug 2025, 15:09:48 (15 months ago)
Author:
Henrik Bettermann
Message:

Round CGPA.

File:
1 edited

Legend:

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

    r17700 r18158  
    2222import grok
    2323import pytz
     24import pytz
     25import decimal
    2426from datetime import datetime
    2527from zope.component.interfaces import IFactory
    26 from zope.component import createObject
     28from zope.component import createObject, getUtility
    2729from zope.interface import implementedBy
    2830from waeup.kofa.utils.helpers import attrs_to_fields
    29 from waeup.kofa.interfaces import RETURNING, VALIDATED, REGISTERED, PAID
     31from waeup.kofa.interfaces import (
     32    RETURNING, VALIDATED, REGISTERED, PAID, IKofaUtils)
    3033from waeup.kofa.students.browser import TicketError
    3134from waeup.kofa.students.studylevel import (
    … …  
    196199        end_level = getattr(certificate, 'end_level', None)
    197200        study_mode = getattr(certificate, 'study_mode', None)
     201        value = decimal.Decimal(str(self.cumulative_params[0]))
     202        cgpa = round(value,2)
     203        #cgpa = self.cumulative_params[0]
    198204        is_dp = False
    199205        if study_mode and study_mode.startswith('dp'):
    … …  
    223229            if self.cumulative_params[1] < 60:
    224230                return 'FRNS'
    225             if self.cumulative_params[0] < failed_limit:
     231            if cgpa < failed_limit:
    226232                return 'Fail'
    227233            dummy, repeat = divmod(self.level, 100)
    228             if self.cumulative_params[0] < 5.1 and repeat == 20:
     234            if cgpa < 5.1 and repeat == 20:
    229235                # Irrespective of the CGPA of a student, if the He/She has
    230236                # 3rd Extension, such student will be graduated with a "Pass".
    231237                return 'Pass'
    232             if self.cumulative_params[0] < 1.5:
     238            if cgpa < 1.5:
    233239                if is_dp:
    234240                    return 'Fail'
    235241                return 'Pass'
    236             if self.cumulative_params[0] < 2.4:
     242            if cgpa < 2.4:
    237243                if is_dp:
    238244                    return 'Pass'
    239245                return '3s_rd_s'
    240             if self.cumulative_params[0] < 3.5:
     246            if cgpa < 3.5:
    241247                if is_dp:
    242248                    return 'Merit'
    243249                return '2s_2_s'
    244             if self.cumulative_params[0] < 4.5:
     250            if cgpa < 4.5:
    245251                if is_dp:
    246252                    return 'Credit'
    247253                return '2s_1_s'
    248             if self.cumulative_params[0] < 5.1:
     254            if cgpa < 5.1:
    249255                if is_dp:
    250256                    return 'Distinction'
    … …  
    262268            # credits taken below limit
    263269            return 'Probation'
    264         if self.cumulative_params[0] < failed_limit:
     270        if cgpa < failed_limit:
    265271            return 'Probation'
    266         if self.cumulative_params[0] < 5.1:
     272        if cgpa < 5.1:
    267273            return 'Proceed'
    268274        return 'N/A'
Note: See TracChangeset for help on using the changeset viewer.