Ignore:
Timestamp:
6 May 2022, 07:19:00 (3 years ago)
Author:
Henrik Bettermann
Message:

abraham: Include 1st and 2nd Semesters Units Summary to Course Registration Page For UNIDEL

Location:
main/kofacustom.unidel/trunk/src/kofacustom/unidel/students
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/batching.py

    r16721 r16949  
    1919"""
    2020from kofacustom.nigeria.students.batching import NigeriaStudentProcessor
    21 from waeup.kofa.students.batching import StudentOnlinePaymentProcessor
     21from waeup.kofa.students.batching import (
     22    StudentOnlinePaymentProcessor, StudentStudyLevelProcessor)
    2223from kofacustom.unidel.students.interfaces import (
    2324    ICustomStudent,
    2425    ICustomStudentUpdateByRegNo,
    2526    ICustomStudentUpdateByMatricNo,
    26     ICustomStudentOnlinePayment
     27    ICustomStudentOnlinePayment,
     28    ICustomStudentStudyLevel
    2729    )
    2830
     
    3840    """
    3941    iface = ICustomStudentOnlinePayment
     42
     43class CustomStudentStudyLevelProcessor(StudentStudyLevelProcessor):
     44    """
     45    """
     46    iface = ICustomStudentStudyLevel
     47
     48    @property
     49    def available_fields(self):
     50        fields = super(
     51            CustomStudentStudyLevelProcessor, self).available_fields + ['previous',]
     52        fields.remove('total_credits_s1')
     53        fields.remove('total_credits_s2')
     54        return  fields
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/browser.py

    r16888 r16949  
    2727from waeup.kofa.browser.layout import action, jsaction
    2828from waeup.kofa.students.browser import (
    29     StudyLevelEditFormPage, StudyLevelDisplayFormPage,
     29    StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudyLevelManageFormPage,
    3030    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
    3131    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
     
    113113    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    114114
     115class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage):
     116    """ Page to display student study levels
     117    """
     118    #grok.template('studylevelpage')
     119    grok.context(ICustomStudentStudyLevel)
     120
     121    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     122        'level',)
     123    form_fields[
     124        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     125
     126class CustomStudyLevelManageFormPage(StudyLevelManageFormPage):
     127    """ Page to edit the student study level data
     128    """
     129    grok.context(ICustomStudentStudyLevel)
     130
     131    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     132        'validation_date', 'validated_by', 'total_credits', 'gpa', 'level',
     133        'total_credits_s1', 'total_credits_s2')
     134
     135class CustomExportPDFCourseRegistrationSlip(ExportPDFCourseRegistrationSlip):
     136    """Deliver a PDF slip of the context.
     137    """
     138    grok.context(ICustomStudentStudyLevel)
     139    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     140        'level', 'gpa', 'transcript_remark')
     141    form_fields[
     142        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     143    #prefix = 'form'
     144    omit_fields = (
     145        'password', 'suspended', 'phone', 'date_of_birth',
     146        'adm_code', 'sex', 'suspended_comment', 'current_level',
     147        'flash_notice')
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/interfaces.py

    r16721 r16949  
    6565    """
    6666
     67    total_credits_s1 = schema.Int(
     68        title = _(u'1st Semester Credits'),
     69        required = False,
     70        )
     71
     72    total_credits_s2 = schema.Int(
     73        title = _(u'2nd Semester Credits'),
     74        required = False,
     75        )
     76
     77    total_credits = schema.Int(
     78        title = _(u'Total Credits'),
     79        required = False,
     80        )
     81
    6782class ICustomStudentOnlinePayment(ICustomOnlinePayment):
    6883    """A student payment via payment gateways.
  • main/kofacustom.unidel/trunk/src/kofacustom/unidel/students/studylevel.py

    r16721 r16949  
    3838    grok.provides(ICustomStudentStudyLevel)
    3939
     40    @property
     41    def total_credits_s1(self):
     42        total = 0
     43        for ticket in self.values():
     44            if ticket.semester == 1 and not ticket.outstanding:
     45                total += ticket.credits
     46        return total
     47
     48    @property
     49    def total_credits_s2(self):
     50        total = 0
     51        for ticket in self.values():
     52            if ticket.semester == 2 and not ticket.outstanding:
     53                total += ticket.credits
     54        return total
     55
    4056CustomStudentStudyLevel = attrs_to_fields(
    41     CustomStudentStudyLevel, omit=['total_credits', 'gpa'])
     57    CustomStudentStudyLevel, omit=['total_credits', 'gpa',
     58        'total_credits_s1', 'total_credits_s2'])
    4259
    4360class CustomStudentStudyLevelFactory(StudentStudyLevelFactory):
Note: See TracChangeset for help on using the changeset viewer.