Changeset 16509 for main/waeup.uniben


Ignore:
Timestamp:
16 Jun 2021, 12:52:36 (3 years ago)
Author:
Henrik Bettermann
Message:

Allow different course gradings according to new course ticket attribute 'grading_sys'.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/batching.py

    r14817 r16509  
    1919"""
    2020from kofacustom.nigeria.students.batching import NigeriaStudentProcessor
    21 from waeup.kofa.students.batching import StudentOnlinePaymentProcessor
     21from waeup.kofa.students.batching import (
     22    StudentOnlinePaymentProcessor, CourseTicketProcessor)
    2223from waeup.uniben.students.interfaces import (
    2324    ICustomStudent,
    2425    ICustomStudentUpdateByRegNo,
    2526    ICustomStudentUpdateByMatricNo,
    26     ICustomStudentOnlinePayment
     27    ICustomStudentOnlinePayment,
     28    ICustomCourseTicketImport
    2729    )
    2830
     
    3840    """
    3941    iface = ICustomStudentOnlinePayment
     42
     43class CustomCourseTicketProcessor(CourseTicketProcessor):
     44    """A batch processor for ICourseTicket objects.
     45    """
     46    iface = ICustomCourseTicketImport
     47
     48    @property
     49    def available_fields(self):
     50        fields = [
     51            'student_id','reg_number','matric_number',
     52            'mandatory', 'score', 'carry_over', 'automatic',
     53            'outstanding', 'course_category', 'level_session',
     54            'title', 'credits', 'passmark', 'semester', 'ticket_session',
     55            'unlock_score', 'grading_sys'
     56            ] + self.additional_fields
     57        return sorted(fields)
     58
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r16458 r16509  
    3232    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
    3333    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
    34     CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
     34    CourseTicketDisplayFormPage,
     35    CourseTicketManageFormPage,
     36    StudentTriggerTransitionFormPage,
    3537    msave, emit_lock_message,
    3638    StudentActivateView, StudentDeactivateView,
     
    7173    ICustomStudentPersonal,
    7274    ICustomStudentPersonalEdit,
    73     IMedicalHistory)
     75    IMedicalHistory,
     76    ICustomCourseTicket)
    7477from waeup.uniben.interfaces import MessageFactory as _
    7578
     
    658661    """ Page to display course tickets
    659662    """
    660     form_fields = grok.AutoFields(ICourseTicket).omit('score')
     663    form_fields = grok.AutoFields(ICustomCourseTicket).omit('score')
     664
     665class CustomCourseTicketManageFormPage(CourseTicketManageFormPage):
     666    """ Page to manage course tickets
     667    """
     668
     669    form_fields = grok.AutoFields(ICustomCourseTicket).omit('course_category')
     670    form_fields['title'].for_display = True
     671    form_fields['fcode'].for_display = True
     672    form_fields['dcode'].for_display = True
     673    form_fields['semester'].for_display = True
     674    form_fields['passmark'].for_display = True
     675    form_fields['credits'].for_display = True
     676    form_fields['mandatory'].for_display = False
     677    form_fields['automatic'].for_display = True
     678    form_fields['carry_over'].for_display = True
     679    form_fields['ticket_session'].for_display = True
    661680
    662681class CustomStudentActivateView(StudentActivateView):
  • main/waeup.uniben/trunk/src/waeup/uniben/students/interfaces.py

    r16385 r16509  
    1818
    1919from zope import schema
    20 from waeup.kofa.interfaces import validate_email, IKofaObject
     20from waeup.kofa.interfaces import (
     21    validate_email, IKofaObject,
     22    academic_sessions_vocab)
    2123from waeup.kofa.students.vocabularies import StudyLevelSource
     24from kofacustom.nigeria.interfaces import GradingSystemSource
    2225from kofacustom.nigeria.students.interfaces import (
    2326    INigeriaStudentBase, INigeriaUGStudentClearance, INigeriaPGStudentClearance,
     
    3033from waeup.uniben.interfaces import MessageFactory as _
    3134
     35
    3236class ICustomStudentBase(INigeriaStudentBase):
    3337    """Representation of student base data.
     
    291295    """
    292296
     297    grading_sys = schema.Choice(
     298        title = _(u'Grading System'),
     299        source = GradingSystemSource(),
     300        required = True,
     301        default = 'A',
     302        )
     303
     304class ICustomCourseTicketImport(ICustomCourseTicket):
     305    """An interface for importing course results and nothing more.
     306    """
     307
     308    score = schema.Int(
     309        title = _(u'Score'),
     310        required = False,
     311        readonly = False,
     312        )
     313
     314    level_session = schema.Choice(
     315        title = _(u'Level Session'),
     316        source = academic_sessions_vocab,
     317        required = False,
     318        readonly = False,
     319        )
     320
     321    grading_sys = schema.Choice(
     322        title = _(u'Grading System'),
     323        source = GradingSystemSource(),
     324        required = False,
     325        default = 'A',
     326        )
     327
    293328class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
    294329    """Representation of a student. Skip regular reg_number validation.
  • main/waeup.uniben/trunk/src/waeup/uniben/students/studylevel.py

    r14359 r16509  
    8787        return True
    8888
     89    @property
     90    def _getGradeWeightFromScore(self):
     91        """Uniben Course Grading System
     92        """
     93        if getattr(self, 'grading_sys', 'A') == 'A':
     94            if self.total_score is None:
     95                return (None, None)
     96            if self.total_score >= 70:
     97                return ('A',5)
     98            if self.total_score >= 60:
     99                return ('B',4)
     100            if self.total_score >= 50:
     101                return ('C',3)
     102            if self.total_score >= 45:
     103                return ('D',2)
     104            if self.total_score >= 40:
     105                return ('E',1)
     106            return ('F',0)
     107        else:
     108            if self.total_score is None:
     109                return (None, None)
     110            if self.total_score >= 70:
     111                return ('A',5)
     112            if self.total_score >= 60:
     113                return ('B',4)
     114            if self.total_score >= 50:
     115                return ('C',3)
     116            if self.total_score >= 45:
     117                return ('D',2)
     118            return ('F',0)
     119
     120
    89121CustomCourseTicket = attrs_to_fields(CustomCourseTicket)
    90122
Note: See TracChangeset for help on using the changeset viewer.