Changeset 14407


Ignore:
Timestamp:
16 Jan 2017, 10:59:01 (8 years ago)
Author:
Henrik Bettermann
Message:

Use old grading system.

Location:
main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/studylevel.py

    r14035 r14407  
    3030from kofacustom.coewarri.students.interfaces import (
    3131    ICustomStudentStudyLevel, ICustomCourseTicket)
     32
     33def getGradeWeightFromScore(score):
     34    if score is None:
     35        return (None, None)
     36    if score >= 70:
     37        return ('A',5)
     38    if score >= 60:
     39        return ('B',4)
     40    if score >= 50:
     41        return ('C',3)
     42    if score >= 45:
     43        return ('D',2)
     44    if score >= 40:
     45        return ('E',1)
     46    return ('F',0)
    3247
    3348
     
    6479    grok.provides(ICustomCourseTicket)
    6580
     81    @property
     82    def grade(self):
     83        """Returns the grade calculated from total score.
     84        """
     85        return getGradeWeightFromScore(self.total_score, self.student)[0]
     86
     87    @property
     88    def weight(self):
     89        """Returns the weight calculated from total score.
     90        """
     91        return getGradeWeightFromScore(self.total_score, self.student)[1]
    6692
    6793CustomCourseTicket = attrs_to_fields(CustomCourseTicket)
  • main/kofacustom.coewarri/trunk/src/kofacustom/coewarri/students/tests/test_export.py

    r14277 r14407  
    44from waeup.kofa.interfaces import ICSVExporter
    55from waeup.kofa.schoolgrades import ResultEntry
    6 from waeup.kofa.students.tests.test_batching import StudentImportExportSetup
     6from waeup.kofa.students.tests.test_batching import (
     7    StudentImportExportSetup, curr_year)
    78from kofacustom.coewarri.utils.utils import CustomKofaUtils
    89from kofacustom.coewarri.students.export import (
     
    107108            'r_pay_reference,thirdparty_amt,student_id,state,'
    108109            'current_session\r\n'
    109             '666,12.12,2012-04-01 13:12:01#,,schoolfee,1,my-id,p-item,'
    110             '100,2012,paid,2012-04-01 14:12:01#,,12.12,'
    111             '789,r-code,interswatch,,,,A111111,created,2012\r\n',
    112             result
     110            '666,12.12,%s-04-01 13:12:01#,,schoolfee,1,my-id,p-item,'
     111            '100,%s,paid,%s-04-01 14:12:01#,,12.12,'
     112            '789,r-code,interswatch,,,,A111111,created,2012\r\n'
     113            % (curr_year-6, curr_year-6, curr_year-6), result
    113114            )
    114115        return
Note: See TracChangeset for help on using the changeset viewer.