Ignore:
Timestamp:
21 Jun 2016, 08:30:14 (9 years ago)
Author:
Henrik Bettermann
Message:

Get grade from total. Use textwrap for fullname.

Location:
main/waeup.aaue/trunk/src/waeup/aaue/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r13963 r13964  
    1818import grok
    1919import csv
     20import textwrap
    2021from cStringIO import StringIO
    2122from zope.i18n import translate
     
    2930from waeup.kofa.students.interfaces import IStudentsUtils, IStudent
    3031from waeup.kofa.students.workflow import PAID, REGISTERED
     32from waeup.kofa.students.studylevel import getGradeWeightFromScore
    3133from waeup.kofa.students.browser import (
    3234    StartClearancePage,
     
    657659                   _('Level'),
    658660                   _('Exam\nScore'),
    659                    _('CA'),
    660                    _('Total'),
     661                   _(' CA  '),
     662                   _('Total '),
    661663                   _('Grade'),
    662664                   ],]
     
    666668            if None in (ticket.score, ticket.ca):
    667669                total = 'n/a'
     670                grade = 'n/a'
    668671            else:
    669672                total = ticket.score + ticket.ca
     673                grade = getGradeWeightFromScore(total)[0]
     674            fullname = textwrap.fill(ticket.student.display_fullname, 30)
    670675            row = [no,
    671676                  ticket.student.matric_number,
    672677                  ticket.student.reg_number,
    673                   ticket.student.display_fullname,
     678                  fullname,
    674679                  ticket.student.translated_state,
    675680                  ticket.student.certcode,
     
    678683                  ticket.score,
    679684                  total,
    680                   ticket.grade,
     685                  grade,
    681686                  ]
    682687            tickets.append(row)
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13963 r13964  
    336336            self.student['studycourse']['100']['COURSE1'].ca, 77)
    337337
     338    def test_lecturers_can_download_course_tickets(self):
     339        # A course ticket slip can be downloaded
     340        self.login_as_lecturer()
     341        pdf_url = '%s/coursetickets.pdf' % self.course_url
     342        self.browser.open(pdf_url)
     343        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     344        self.assertEqual(
     345            self.browser.headers['Content-Type'], 'application/pdf')
     346        path = os.path.join(samples_dir(), 'coursetickets.pdf')
     347        open(path, 'wb').write(self.browser.contents)
     348        print "Sample PDF coursetickets.pdf written to %s" % path
     349
    338350class StudentUITests(StudentsFullSetup):
    339351    """Tests for customized student class views and pages
Note: See TracChangeset for help on using the changeset viewer.