Ignore:
Timestamp:
17 Sep 2020, 07:34:46 (4 years ago)
Author:
Henrik Bettermann
Message:

Don't allow the total outcome of course grade exceed 100 (ie if CA + Score > 100, return "total score is greater than 100").

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

    r16143 r16240  
    10761076                    imported_ts = int(formvals[sid][2])
    10771077            except ValueError:
     1078                error += '%s, ' % ticket.student.display_fullname
     1079                ticket_error = True
     1080            if score and ca and not ticket_error and score + ca > 100:
    10781081                error += '%s, ' % ticket.student.display_fullname
    10791082                ticket_error = True
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r15997 r16240  
    372372        self.browser.open(self.edit_scores_url)
    373373        upload_ctrl = self.browser.getControl(name='uploadfile:file')
     374        upload_file = StringIO(UPLOAD_CSV_TEMPLATE % ('65','52','77'))
     375        upload_ctrl.add_file(upload_file, 'text/csv', 'myscores.csv')
     376        self.browser.getControl("Update editable scores from").click()
     377        self.assertTrue('TESTER, Anna have not be updated' in self.browser.contents)
     378        # values have not been changed
     379        self.assertEqual(
     380            self.student['studycourse']['100']['COURSE1'].score, 55)
     381        self.assertEqual(
     382            self.student['studycourse']['100']['COURSE1'].ca, None)
     383        self.assertEqual(
     384            self.student['studycourse']['100']['COURSE1'].imported_ts, None)
     385        self.browser.open(self.edit_scores_url)
     386        upload_ctrl = self.browser.getControl(name='uploadfile:file')
    374387        upload_file = StringIO(UPLOAD_CSV_TEMPLATE % ('65','22','77'))
    375388        upload_ctrl.add_file(upload_file, 'text/csv', 'myscores.csv')
    376389        self.browser.getControl("Update editable scores from").click()
    377         # value changed
     390        # values changed
    378391        self.assertEqual(
    379392            self.student['studycourse']['100']['COURSE1'].score, 65)
Note: See TracChangeset for help on using the changeset viewer.