Ignore:
Timestamp:
21 Sep 2013, 05:12:49 (11 years ago)
Author:
Henrik Bettermann
Message:

Define conditions for score editing. Tests will follow.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
3 edited

Legend:

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

    r10630 r10631  
    30553055        session = academic_sessions_vocab.getTerm(
    30563056            self.current_academic_session).title
    3057         return 'Students registered for %s in academic session %s' % (
    3058             self.context.longtitle(), session)
     3057        return '%s tickets in academic session %s' % (
     3058            self.context.code, session)
    30593059
    30603060    def _searchCatalog(self, session):
     
    30733073        datatable.need()
    30743074        self.tickets = self._searchCatalog(self.current_academic_session)
     3075        editable_tickets = [
     3076            ticket for ticket in self.tickets if ticket.editable_by_lecturer]
    30753077        if not self.tickets:
    30763078            self.flash(_('No student found.'))
     
    30793081            tno = 0
    30803082            error = ''
    3081             for ticket in self.tickets:
     3083            if not editable_tickets:
     3084                return
     3085            scores = form['scores']
     3086            if isinstance(scores, basestring):
     3087                scores = [scores]
     3088            for ticket in editable_tickets:
    30823089                score = ticket.score
    30833090                try:
    3084                     score = int(form['scores'][tno])
     3091                    score = int(scores[tno])
    30853092                except ValueError:
    30863093                    error += '%s, ' % ticket.student.display_fullname
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/editscorespage.pt

    r10627 r10631  
    2525      <td tal:content="ticket/student/current_level">LEVEL</td>
    2626      <td tal:content="ticket/level">LEVEL</td>
    27           <td><input type="text" name="scores" class="span1"
    28                      tal:attributes="value ticket/score" /></td>
     27          <td tal:condition="ticket/editable_by_lecturer">
     28          <input type="text" name="scores" class="span1"
     29                     tal:attributes="value ticket/score" />
     30      </td>
     31      <td tal:condition="not: ticket/editable_by_lecturer"
     32          tal:content="ticket/score">SCORE</td>
    2933        </tr>
    3034    </tbody>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r10618 r10631  
    2525from zope.component import createObject, queryUtility
    2626from zope.interface import implementedBy
    27 from waeup.kofa.interfaces import academic_sessions_vocab
     27from waeup.kofa.interfaces import academic_sessions_vocab, VALIDATED
    2828from waeup.kofa.students.interfaces import (
    2929    IStudentStudyLevel, IStudentNavigation, ICourseTicket)
     
    291291        return not self.mandatory
    292292
     293    @property
     294    def editable_by_lecturer(self):
     295        cas = grok.getSite()['configuration'].current_academic_session
     296        if self.student.state == VALIDATED and self.student.current_session == cas:
     297            return True
     298        return False
     299
    293300    def writeLogMessage(self, view, message):
    294301        return self.__parent__.__parent__.__parent__.writeLogMessage(view, message)
Note: See TracChangeset for help on using the changeset viewer.