Ignore:
Timestamp:
23 Aug 2016, 07:00:13 (8 years ago)
Author:
Henrik Bettermann
Message:

Define max values for score and ca.

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

    r14104 r14113  
    2222from zope.i18n import translate
    2323from zope.component import getUtility, queryUtility
     24from zope.schema.interfaces import TooBig, TooSmall
    2425from zope.security import checkPermission
    2526from zope.catalog.interfaces import ICatalog
     
    699700                ticket_error = True
    700701            if not ticket_error and ticket.score != score:
    701                 ticket.score = score
     702                try:
     703                    ticket.score = score
     704                except TooBig:
     705                    error += '%s, ' % ticket.student.display_fullname
     706                    ticket_error = True
     707                    pass
    702708                ticket.student.__parent__.logger.info(
    703709                    '%s - %s %s/%s score updated (%s)' %
     
    705711                     ticket.level, ticket.code, score))
    706712            if not ticket_error and ticket.ca != ca:
    707                 ticket.ca = ca
     713                try:
     714                    ticket.ca = ca
     715                except TooBig:
     716                    error += '%s, ' % ticket.student.display_fullname
     717                    pass
    708718                ticket.student.__parent__.logger.info(
    709719                    '%s - %s %s/%s ca updated (%s)' %
     
    712722        if error:
    713723            self.flash(_('Error: Score(s) and CA(s) of %s have not be updated. '
    714               'Only integers are allowed.' % error.strip(', ')),
    715               type="danger")
     724              % error.strip(', ')), type="danger")
    716725            return
    717726        self.flash(_('You successfully updated course results.'))
  • main/waeup.aaue/trunk/src/waeup/aaue/students/interfaces.py

    r14107 r14113  
    333333    """
    334334
     335    score = schema.Int(
     336        title = _(u'Score'),
     337        required = False,
     338        readonly = False,
     339        max = 70,
     340        )
     341
    335342    ca = schema.Int(
    336343        title = _(u'CA'),
     
    338345        required = False,
    339346        missing_value = None,
     347        max = 30,
    340348        )
    341349
     
    347355        required = False,
    348356        readonly = False,
     357        max = 70,
    349358        )
    350359
     
    353362        required = False,
    354363        readonly = False,
     364        max = 30,
    355365        )
    356366
Note: See TracChangeset for help on using the changeset viewer.