Changeset 16817 for main/kofacustom.dspg


Ignore:
Timestamp:
17 Feb 2022, 09:09:52 (3 years ago)
Author:
Henrik Bettermann
Message:

Show semester credits on study level pages.

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

Legend:

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

    r14716 r16817  
    2727    ICustomStudent, ICustomStudentUpdateByRegNo,
    2828    ICustomStudentUpdateByMatricNo,
    29     ICustomStudentOnlinePayment
     29    ICustomStudentOnlinePayment,
     30    ICustomStudentStudyLevel
    3031    )
    3132from waeup.kofa.students.batching import (
    32     StudentProcessor, StudentOnlinePaymentProcessor)
     33    StudentProcessor, StudentOnlinePaymentProcessor,
     34    StudentStudyLevelProcessor)
    3335
    3436class CustomStudentProcessor(StudentProcessor):
     
    4345    """
    4446    iface = ICustomStudentOnlinePayment
     47
     48class CustomStudentStudyLevelProcessor(StudentStudyLevelProcessor):
     49    """
     50    """
     51    iface = ICustomStudentStudyLevel
     52
     53    @property
     54    def available_fields(self):
     55        fields = super(CustomStudentStudyLevelProcessor, self).available_fields
     56        fields.remove('total_credits_s1')
     57        fields.remove('total_credits_s2')
     58        return  fields
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py

    r16155 r16817  
    2626    KofaEditFormPage, UtilityView, action, jsaction)
    2727from waeup.kofa.students.browser import (
    28     StudyLevelEditFormPage, StudyLevelDisplayFormPage,
     28    StudyLevelEditFormPage, StudyLevelDisplayFormPage, StudyLevelManageFormPage,
    2929    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
    3030    CourseTicketDisplayFormPage, StudentTriggerTransitionFormPage,
     
    8080    """
    8181    grok.template('studylevelpage')
     82    grok.context(ICustomStudentStudyLevel)
     83    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     84        'level',)
     85    form_fields[
     86        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    8287
    8388class CustomStudyLevelEditFormPage(StudyLevelEditFormPage):
     
    9297    form_fields = grok.AutoFields(ICourseTicket).omit('score')
    9398
     99class CustomStudyLevelManageFormPage(StudyLevelManageFormPage):
     100    """ Page to edit the student study level data
     101    """
     102    grok.context(ICustomStudentStudyLevel)
     103
     104    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     105        'validation_date', 'validated_by', 'total_credits', 'gpa', 'level',
     106        'total_credits_s1', 'total_credits_s2')
     107
    94108class CustomExportPDFCourseRegistrationSlip(ExportPDFCourseRegistrationSlip):
    95109    """Deliver a PDF slip of the context.
    96110    """
     111    grok.context(ICustomStudentStudyLevel)
     112    form_fields = grok.AutoFields(ICustomStudentStudyLevel).omit(
     113        'level', 'gpa', 'transcript_remark')
     114    form_fields[
     115        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     116    prefix = 'form'
     117    omit_fields = (
     118        'password', 'suspended', 'phone', 'date_of_birth',
     119        'adm_code', 'sex', 'suspended_comment', 'current_level',
     120        'flash_notice')
    97121
    98122    def render(self):
  • main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/interfaces.py

    r14716 r16817  
    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.dspg/trunk/src/kofacustom/dspg/students/studylevel.py

    r15097 r16817  
    3939
    4040    @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
     56    @property
    4157    def gpa_params(self):
    4258        """Calculate gpa parameters for this level.
     
    6076
    6177CustomStudentStudyLevel = attrs_to_fields(
    62     CustomStudentStudyLevel, omit=['total_credits', 'gpa'])
     78    CustomStudentStudyLevel, omit=['total_credits', 'gpa',
     79        'total_credits_s1', 'total_credits_s2'])
    6380
    6481class CustomStudentStudyLevelFactory(StudentStudyLevelFactory):
Note: See TracChangeset for help on using the changeset viewer.