Ignore:
Timestamp:
10 Feb 2017, 17:03:20 (8 years ago)
Author:
Henrik Bettermann
Message:

If ticket.score is set to '-1', total_score will be 0 and the grade is '-'.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/locales/en/LC_MESSAGES/waeup.kofa.po

    r14522 r14532  
    160160msgstr "Name (Surname First)"
    161161
    162 msgid "Total Credits Registered"
    163 msgstr "Total Units Registered"
     162msgid "Total Credits Taken"
     163msgstr "Total Units Taken"
    164164
    165165msgid "Total Credits Passed"
    166166msgstr "Total Units Passed"
    167167
    168 msgid "Cum. Credits Registered"
    169 msgstr "Cum. Units Registered"
     168msgid "Cum. Credits Taken"
     169msgstr "Cum. Units Taken"
    170170
    171171msgid "Cum. Credits Passed"
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r14527 r14532  
    3333    IStudentsUtils, IStudent, IStudentRequestPW)
    3434from waeup.kofa.students.workflow import PAID, REGISTERED, RETURNING
    35 from waeup.kofa.students.studylevel import getGradeWeightFromScore
    3635from waeup.kofa.students.browser import (
    3736    StartClearancePage,
     
    865864        # In AAUE only editable tickets can be printed
    866865        for ticket in sorted_tickets:
    867             if None in (ticket.score, ticket.ca):
     866            if ticket.total_score is None:
    868867                total = 'n/a'
    869868                grade = 'n/a'
    870869            else:
    871                 total = ticket.score + ticket.ca
    872                 grade = getGradeWeightFromScore(total, ticket.student)[0]
    873                 if grade == 'F':
     870                total = ticket.total_score
     871                grade = ticket._getGradeWeightFromScore[0]
     872                if grade in ('F', '-'):
    874873                    failed += 1
    875874                else:
  • main/waeup.aaue/trunk/src/waeup/aaue/students/reports/tests/test_raw_score_report.py

    r14528 r14532  
    3737        # we can get a list with one course code
    3838        result = get_courses('fac1', 'dep1', 'CERT1', 2010, 100)
    39         self.assertEqual(result, [(u'Course1')])
     39        self.assertEqual(result, [u'Course1'])
    4040        return
    4141
     
    5454
    5555    def test_create_pdf(self):
    56         self.course = createObject('waeup.Course')
    57         self.course.code = 'Course2'
    58         self.course.credits = 30
     56        self.course2 = createObject('waeup.Course')
     57        self.course2.code = 'Course2'
     58        self.course2.credits = 30
    5959        self.app['faculties']['fac1']['dep1'].courses.addCourse(
    60             self.course)
     60            self.course2)
    6161        self.app['faculties']['fac1']['dep1'].certificates[
    62             'CERT1'].addCertCourse(self.course, level=100)
     62            'CERT1'].addCertCourse(self.course2, level=100)
     63        self.course3 = createObject('waeup.Course')
     64        self.course3.code = 'Course3'
     65        self.course3.credits = 30
     66        self.app['faculties']['fac1']['dep1'].courses.addCourse(
     67            self.course3)
     68        self.app['faculties']['fac1']['dep1'].certificates[
     69            'CERT1'].addCertCourse(self.course3, level=100)
    6370        self.app['faculties']['fac1'].officer_1 = 'Rosa Moonshine - Dean of Faculty'
    6471        self.app['faculties']['fac1']['dep1'].officer_1 = 'Amalia Sunshine - Head of Department'
     
    7380        ticket.ca = 10
    7481        self.student['studycourse']['200']['Course2'] = ticket
     82        ticket = createObject('waeup.CourseTicket')
     83        ticket.code = 'Course3'
     84        ticket.credits = 30
     85        # core course, no result available
     86        ticket.score = -1
     87        ticket.ca = 0
     88        self.student['studycourse']['200']['Course3'] = ticket
     89        self.assertEqual(ticket.grade, '-')
    7590        self.student.firstname = u'Osahenokese Tessy'
    7691        self.student.lastname = u'Emwinyomwanru'
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r14509 r14532  
    6868        level_gpa = 0.0
    6969        for ticket in self.values():
    70             if None not in (ticket.score, ticket.ca):
     70            if ticket.total_score is not None:
    7171                credits_counted += ticket.credits
    7272                credits_weighted += ticket.credits * ticket.weight
     
    9494        courses_not_taken = ''
    9595        for ticket in self.values():
    96             if None not in (ticket.score, ticket.ca):
     96            if ticket.total_score is not None:
    9797                if ticket.total_score < ticket.passmark:
    9898                    failed += 1
     
    361361
    362362    @property
     363    def _getGradeWeightFromScore(self):
     364        """Nigerian Course Grading System
     365        """
     366        if self.score == -1:
     367            return ('-',0) # core course and result not yet available (used by AAUE)
     368        if self.total_score is None:
     369            return (None, None)
     370        if self.total_score >= 70:
     371            return ('A',5)
     372        if self.total_score >= 60:
     373            return ('B',4)
     374        if self.total_score >= 50:
     375            return ('C',3)
     376        if self.total_score >= 45:
     377            return ('D',2)
     378        if self.total_score >= self.passmark: # passmark changed in 2013 from 40 to 45
     379            return ('E',1)
     380        return ('F',0)
     381
     382    @property
    363383    def total_score(self):
    364384        """Returns ca + score.
    365385        """
     386        if self.score == -1:
     387            return 0
    366388        if not None in (self.score, self.ca):
    367389            return self.score + self.ca
     390        return None
    368391
    369392    @property
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14515 r14532  
    405405        # A course ticket slip can be downloaded
    406406        self.login_as_lecturer()
     407        self.student['studycourse']['100']['COURSE1'].score = 55
     408        self.student['studycourse']['100']['COURSE1'].ca = 11
    407409        pdf_url = '%s/coursetickets.pdf' % self.course_url
    408410        self.browser.open(pdf_url)
Note: See TracChangeset for help on using the changeset viewer.