Ignore:
Timestamp:
10 Mar 2023, 09:13:25 (22 months ago)
Author:
Henrik Bettermann
Message:

Add carryover score field.

Location:
main/kofacustom.edocons/trunk/src/kofacustom/edocons
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/interswitch/browser.py

    r17045 r17345  
    164164        xmldict['institution_bank_id'] = '31'
    165165        if self.context.__parent__.__parent__.prefix.startswith('tsc'):
    166             provider_amt = 2000.0
    167166            midwife_amt = 0.0
    168167            xmldict['institution_acct'] = '1000907711'
     
    195194</item_details>
    196195</payment_item_detail>""" % xmldict
     196        elif not provider_amt and midwife_amt:
     197            xmltext = """<payment_item_detail>
     198<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
     199<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
     200<item_detail item_id="2" item_name="Nursing and Midwifery Committee" item_amt="%(midwife_amt)d" bank_id="8" acct_num="2004854377" />
     201</item_details>
     202</payment_item_detail>""" % xmldict
    197203        else:
    198204            xmltext = """<payment_item_detail>
    199205<item_details detail_ref="%(detail_ref)s" college="%(institution_name)s">
    200206<item_detail item_id="1" item_name="%(institution_item_name)s" item_amt="%(institution_amt)d" bank_id="%(institution_bank_id)s" acct_num="%(institution_acct)s" />
    201 <item_detail item_id="2" item_name="Nursing and Midwifery Committee" item_amt="%(midwife_amt)d" bank_id="8" acct_num="2004854377" />
    202207</item_details>
    203208</payment_item_detail>""" % xmldict
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/browser.py

    r17344 r17345  
    3030    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
    3131    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
    32     CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
     32    CourseTicketDisplayFormPage,
     33    CourseTicketManageFormPage,
     34    StudyLevelDisplayFormPage,
     35    StudentTriggerTransitionFormPage,
    3336    ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage,
    3437    BalancePaymentAddFormPage, msave, emit_lock_message)
     
    4851from kofacustom.edocons.students.interfaces import (
    4952    ICustomStudentOnlinePayment, ICustomStudentStudyCourse,
    50     ICustomStudentStudyLevel)
     53    ICustomStudentStudyLevel, ICustomCourseTicket)
    5154from kofacustom.edocons.interfaces import MessageFactory as _
     55
     56def translated_values(view):
     57    """Translate course ticket attribute values to be displayed on
     58    studylevel pages.
     59    """
     60    lang = view.request.cookies.get('kofa.language')
     61    for value in view.context.values():
     62        # We have to unghostify (according to Tres Seaver) the __dict__
     63        # by activating the object, otherwise value_dict will be empty
     64        # when calling the first time.
     65        value._p_activate()
     66        value_dict = dict([i for i in value.__dict__.items()])
     67        value_dict['url'] = view.url(value)
     68        value_dict['removable_by_student'] = value.removable_by_student
     69        value_dict['mandatory'] = translate(str(value.mandatory), 'zope',
     70            target_language=lang)
     71        value_dict['carry_over'] = translate(str(value.carry_over), 'zope',
     72            target_language=lang)
     73        value_dict['outstanding'] = translate(str(value.outstanding), 'zope',
     74            target_language=lang)
     75        value_dict['automatic'] = translate(str(value.automatic), 'zope',
     76            target_language=lang)
     77        value_dict['grade'] = value.grade
     78        value_dict['weight'] = value.weight
     79        value_dict['course_category'] = value.course_category
     80        value_dict['total_score'] = value.total_score
     81        semester_dict = getUtility(IKofaUtils).SEMESTER_DICT
     82        value_dict['semester'] = semester_dict[
     83            value.semester].replace('mester', 'm.')
     84        # ECNS specific
     85        value_dict['carryover_score'] = value.carryover_score
     86        yield value_dict
    5287
    5388class CustomStartClearancePage(StartClearancePage):
     
    118153class CustomBedTicketAddPage(NigeriaBedTicketAddPage):
    119154    with_ac = False
     155
     156class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
     157    """ Page to display student study levels
     158    """
     159    @property
     160    def translated_values(self):
     161        return translated_values(self)
     162
     163       
     164class CustomCourseTicketDisplayFormPage(CourseTicketDisplayFormPage):
     165    """ Page to display course tickets
     166    """
     167    form_fields = grok.AutoFields(ICustomCourseTicket).omit('course_category',
     168        'ticket_session')
     169
     170    @property
     171    def form_fields(self):
     172        if not self.context.carry_over:
     173            return grok.AutoFields(ICustomCourseTicket).omit('carryover_score')
     174        return grok.AutoFields(ICustomCourseTicket)
     175
     176class CustomCourseTicketManageFormPage(CourseTicketManageFormPage):
     177    """ Page to manage course tickets
     178    """
     179    form_fields = grok.AutoFields(ICustomCourseTicket)
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/interfaces.py

    r16639 r17345  
    9292    """
    9393
     94    carryover_score = schema.Int(
     95        title = _(u'Carry-over Score'),
     96        default = None,
     97        required = False,
     98        missing_value = None,
     99        max = 100,
     100        )
     101
     102ICustomCourseTicket['carryover_score'].order = ICustomCourseTicket['carry_over'].order
     103
    94104class ICustomStudentUpdateByRegNo(INigeriaStudentUpdateByRegNo):
    95105    """Representation of a student. Skip regular reg_number validation.
Note: See TracChangeset for help on using the changeset viewer.