Changeset 17406


Ignore:
Timestamp:
9 May 2023, 15:19:08 (20 months ago)
Author:
Henrik Bettermann
Message:

Add fields and change field names.

Location:
main/kofacustom.edocons/trunk/src/kofacustom/edocons/students
Files:
5 edited

Legend:

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

    r17405 r17406  
    5555            'title', 'credits', 'passmark', 'semester', 'ticket_session',
    5656            'unlock_score', 'previous', 'carryover_score', 'in_progress',
    57             'resumption_date', 'rst_grade', 'attempted_number'
     57            'resumption_date', 'carryover_grade', 'attempts'
    5858            ] + self.additional_fields
    5959        return sorted(fields)
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/browser.py

    r17393 r17406  
    3030    StudyLevelEditFormPage, StudyLevelDisplayFormPage,
    3131    StudentBasePDFFormPage, ExportPDFCourseRegistrationSlip,
     32    ExportPDFTranscriptSlip,
    3233    CourseTicketDisplayFormPage,
    3334    CourseTicketManageFormPage,
    3435    StudyLevelDisplayFormPage,
     36    StudyLevelManageFormPage,
    3537    StudentTriggerTransitionFormPage,
    3638    ExportPDFAdmissionSlip, StartClearancePage, PaymentsManageFormPage,
     
    162164        return translated_values(self)
    163165
     166class CustomStudyLevelManageFormPage(StudyLevelManageFormPage):
     167    """ Page to edit the student study level data
     168    """
     169
    164170class CustomExportPDFCourseRegistrationSlip(NigeriaExportPDFCourseRegistrationSlip):
    165171    """Deliver a PDF slip of the context.
     
    177183        Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language)
    178184        #Mand = translate(_('Requ.'), 'waeup.kofa', target_language=portal_language)
    179         Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language)
    180         Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language)
     185        #Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language)
     186        #Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language)
    181187        studentview = StudentBasePDFFormPage(self.context.student,
    182188            self.request, self.omit_fields)
     
    194200                             (Cred, 'credits', 1.5),
    195201                             #(Mand, 'mandatory', 1.5),
    196                              (Score, 'score', 1.5),
    197                              (Grade, 'grade', 1.5),
    198                              ('RST', 'carryover_score', 1.5),
     202                             ('Score', 'score', 1.5),
     203                             ('Grade', 'grade', 1.5),
     204                             ('RST Score', 'carryover_score', 1.5),
     205                             ('RST Grade', 'carryover_grade', 1.5),
    199206                             #('Auto', 'automatic', 1.5)
    200207                             ])
     
    225232    """
    226233    form_fields = grok.AutoFields(ICustomCourseTicket)
     234
     235class ExportPDFTranscriptSlip(ExportPDFTranscriptSlip):
     236    """Deliver a PDF slip of the context.
     237    """
     238
     239    def render(self):
     240        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
     241        Term = translate(_('Term'), 'waeup.kofa', target_language=portal_language)
     242        Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language)
     243        Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language)
     244        Cred = translate(_('Credits'), 'waeup.kofa', target_language=portal_language)
     245        Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language)
     246        Grade = translate(_('Grade'), 'waeup.kofa', target_language=portal_language)
     247        studentview = StudentBasePDFFormPage(self.context.student,
     248            self.request, self.omit_fields)
     249        students_utils = getUtility(IStudentsUtils)
     250
     251        tableheader = [(Code,'code', 2.5),
     252                         (Title,'title', 7),
     253                         (Term, 'semester', 1.5),
     254                         (Cred, 'credits', 1.5),
     255                         (Score, 'total_score', 1.5),
     256                         (Grade, 'grade', 1.5),
     257                         ('Attmpt', 'attempted_number', 1.5)
     258                         ]
     259
     260        pdfstream = students_utils.renderPDFTranscript(
     261            self, 'transcript.pdf',
     262            self.context.student, studentview,
     263            omit_fields=self.omit_fields,
     264            tableheader=tableheader,
     265            signatures=self._signatures(),
     266            sigs_in_footer=self._sigsInFooter(),
     267            digital_sigs=self._digital_sigs(),
     268            save_file=self._save_file(),
     269            )
     270        if not pdfstream:
     271            self.redirect(self.url(self.context.student))
     272            return
     273        return pdfstream
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/browser_templates/studylevelpage.pt

    r17345 r17406  
    3030      <th i18n:translate="">Score</th>
    3131      <th i18n:translate="">Grade</th>
    32       <th i18n:translate="">RST</th>
     32      <th i18n:translate="">RST Score</th>
     33      <th i18n:translate="">RST Grade</th>
    3334      <th i18n:translate="">OS</th>
    3435      <th i18n:translate="">Auto</th>
     
    4950      <td tal:content="value/grade|nothing">GRADE</td>
    5051      <td tal:content="value/carryover_score">RSTSCORE</td>
     52      <td tal:content="value/carryover_grade">RSTGRADE</td>
    5153      <td tal:content="value/outstanding">OS</td>
    5254      <td tal:content="value/automatic">AUTO</td>
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/interfaces.py

    r17405 r17406  
    9494    """
    9595
     96    automatic = schema.Bool(
     97        title = _(u'Automatical Creation'),
     98        default = False,
     99        required = False,
     100        )
     101
     102    carry_over = schema.Bool(
     103        title = _(u'Carry-over Course'),
     104        default = False,
     105        required = False,
     106        )
     107
    96108    carryover_score = schema.Int(
    97         title = _(u'Carry-over Score'),
     109        title = _(u'Carry-over (RST) Score'),
    98110        default = None,
    99111        required = False,
     
    102114        )
    103115
    104     attempted_number = schema.Int(
    105         title = _(u'Attempted Number'),
     116    carryover_grade = schema.TextLine(
     117        title = _(u'Carry-over (RST) Grade'),
     118        required = False,
     119        )
     120
     121    attempts = schema.Int(
     122        title = _(u'Number of Attempts'),
    106123        default = None,
    107124        required = False,
    108125        missing_value = None,
    109126        max = 5,
    110         )
    111 
    112     rst_grade = schema.TextLine(
    113         title = _(u'RST Grade'),
    114         required = False,
    115127        )
    116128
     
    127139        )
    128140
    129 ICustomCourseTicket['carryover_score'].order = ICustomCourseTicket['carry_over'].order
     141    score = schema.Int(
     142        title = _(u'(Final) Score'),
     143        default = None,
     144        required = False,
     145        missing_value = None,
     146        )
     147
     148#ICustomCourseTicket['carryover_score'].order = ICustomCourseTicket['carry_over'].order
    130149#ICustomCourseTicket['in_progress'].order = ICustomCourseTicket['grade'].order
    131150#ICustomCourseTicket['resumption_date'].order = ICustomCourseTicket['grade'].order
  • main/kofacustom.edocons/trunk/src/kofacustom/edocons/students/tests/test_browser.py

    r16695 r17406  
    6868        open(path, 'wb').write(self.browser.contents)
    6969        print "Sample PDF UG admission_slip.pdf written to %s" % path
     70
     71    def test_transcripts(self):
     72        studylevel = createObject(u'waeup.StudentStudyLevel')
     73        studylevel.level = 100
     74        studylevel.level_session = 2005
     75        self.student['studycourse'].entry_mode = 'ug_ft'
     76        self.student['studycourse'].addStudentStudyLevel(
     77            self.certificate, studylevel)
     78        studylevel2 = createObject(u'waeup.StudentStudyLevel')
     79        studylevel2.level = 110
     80        studylevel2.level_session = 2006
     81        self.student['studycourse'].addStudentStudyLevel(
     82            self.certificate, studylevel2)
     83        # Add second course (COURSE has been added automatically)
     84        courseticket = createObject('waeup.CourseTicket')
     85        courseticket.code = 'ANYCODE'
     86        courseticket.title = u'Any TITLE'
     87        courseticket.credits = 13
     88        courseticket.score = 66
     89        courseticket.semester = 1
     90        courseticket.attempted_number = 4
     91        courseticket.dcode = u'ANYDCODE'
     92        courseticket.fcode = u'ANYFCODE'
     93        self.student['studycourse']['110']['COURSE2'] = courseticket
     94        self.student['studycourse']['100']['COURSE1'].score = 55
     95        self.assertEqual(self.student['studycourse']['100'].gpa_params_rectified[0], 2.5)
     96        self.assertEqual(self.student['studycourse']['110'].gpa_params_rectified[0], 3.0)
     97        # Get transcript data
     98        td = self.student['studycourse'].getTranscriptData()
     99        self.assertEqual(td[0][0]['level_key'], '100')
     100        self.assertEqual(td[0][0]['sgpa'], 2.5)
     101        self.assertEqual(td[0][0]['level'].level, 100)
     102        self.assertEqual(td[0][0]['level'].level_session, 2005)
     103        self.assertEqual(td[0][0]['tickets_1'][0].code, 'COURSE1')
     104        self.assertEqual(td[0][1]['level_key'], '110')
     105        self.assertEqual(td[0][1]['sgpa'], 3.0)
     106        self.assertEqual(td[0][1]['level'].level, 110)
     107        self.assertEqual(td[0][1]['level'].level_session, 2006)
     108        self.assertEqual(td[0][1]['tickets_1'][0].code, 'ANYCODE')
     109        self.assertEqual(td[1], 2.782608695652174)
     110        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     111        self.browser.open(self.student_path + '/studycourse/transcript')
     112        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     113        self.assertTrue('Transcript' in self.browser.contents)
     114        # Officers can open the pdf transcript
     115        self.browser.open(self.student_path + '/studycourse/transcript.pdf')
     116        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     117        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     118        path = os.path.join(samples_dir(), 'transcript.pdf')
     119        open(path, 'wb').write(self.browser.contents)
     120        print "Sample PDF transcript.pdf written to %s" % path
    70121 
Note: See TracChangeset for help on using the changeset viewer.