Ignore:
Timestamp:
4 Jun 2016, 08:53:32 (9 years ago)
Author:
Henrik Bettermann
Message:

Bugfix. The order of formscores? depends on Javascript sorting.

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

Legend:

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

    r13773 r13874  
    31243124            return
    31253125        if 'UPDATE' in form:
    3126             tno = 0
    31273126            error = ''
    31283127            if not editable_tickets:
    31293128                return
    31303129            scores = form['scores']
     3130            sids = form['sids']
    31313131            if isinstance(scores, basestring):
    31323132                scores = [scores]
     3133            if isinstance(sids, basestring):
     3134                sids = [sids]
     3135            formvals = dict([(sids[i], scores[i]) for i in range(len(sids))])
    31333136            for ticket in editable_tickets:
    31343137                score = ticket.score
    3135                 if scores[tno] == '':
     3138                sid = ticket.student.student_id
     3139                if formvals[sid] == '':
    31363140                    score = None
    31373141                else:
    31383142                    try:
    3139                         score = int(scores[tno])
     3143                        score = int(formvals[sid])
    31403144                    except ValueError:
    31413145                        error += '%s, ' % ticket.student.display_fullname
     
    31473151                         ticket.level, ticket.code, score))
    31483152                    #notify(grok.ObjectModifiedEvent(ticket))
    3149                 tno += 1
    31503153            if error:
    31513154                self.flash(_('Error: Score(s) of %s have not be updated. '
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/editscorespage.pt

    r13769 r13874  
    2121          <input type="text" name="scores" class="form-control"
    2222                     tal:attributes="value ticket/score" />
     23          <input type="hidden" name="sids"
     24                 tal:attributes="value ticket/student/student_id" />
    2325      </td>
    2426      <td tal:condition="not: ticket/editable_by_lecturer"
Note: See TracChangeset for help on using the changeset viewer.