Changeset 13875 for main


Ignore:
Timestamp:
4 Jun 2016, 08:55:08 (8 years ago)
Author:
Henrik Bettermann
Message:

Bugfix, see #222.

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

    r13866 r13875  
    558558            return
    559559        if 'UPDATE' in form:
    560             tno = 0
    561560            error = ''
    562561            if not editable_tickets:
     
    564563            scores = form['scores']
    565564            cas = form['cas']
     565            sids = form['sids']
    566566            if isinstance(scores, basestring):
    567567                scores = [scores]
    568568            if isinstance(cas, basestring):
    569569                cas = [cas]
     570            if isinstance(sids, basestring):
     571                sids = [sids]
     572            formvals = dict([(sids[i], (scores[i], cas[i]))
     573                             for i in range(len(sids))])
    570574            for ticket in editable_tickets:
    571575                ticket_error = False
    572576                score = ticket.score
    573577                ca = ticket.ca
    574                 if scores[tno] == '':
     578                sid = ticket.student.student_id
     579                if formvals[sid][0] == '':
    575580                    score = None
    576                 if cas[tno] == '':
     581                if formvals[sid][1] == '':
    577582                    ca = None
    578583                try:
    579                     if scores[tno]:
    580                         score = int(scores[tno])
    581                     if cas[tno]:
    582                         ca = int(cas[tno])
     584                    if formvals[sid][0]:
     585                        score = int(formvals[sid][0])
     586                    if formvals[sid][1]:
     587                        ca = int(formvals[sid][1])
    583588                except ValueError:
    584589                    error += '%s, ' % ticket.student.display_fullname
     
    596601                        (ob_class, ticket.student.student_id,
    597602                         ticket.level, ticket.code, ca))
    598                 tno += 1
    599603            if error:
    600604                self.flash(_('Error: Score(s) and CA(s) of %s have not be updated. '
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser_templates/editscorespage.pt

    r13770 r13875  
    2222          <input type="text" name="scores" class="form-control"
    2323                     tal:attributes="value ticket/score" />
     24          <input type="hidden" name="sids"
     25                 tal:attributes="value ticket/student/student_id" />
    2426      </td>
    2527          <td tal:condition="ticket/editable_by_lecturer" style="width: 65px;">
Note: See TracChangeset for help on using the changeset viewer.