Open damithc opened 10 years ago
From dam...@gmail.com on January 27, 2014 01:03:59
This seems relevant http://stackoverflow.com/questions/1458633/elegant-workaround-for-javascript-floating-point-number-problem
From lwl1991 on March 18, 2014 07:33:49
Another issue/bug i found related to this:
I was able to submit an answer of 9 for a numscale question with a max value of 5. This was done with some "hack" on firefox 12. (Not very sure if this is pushing the system too much, but a student could do this.)
Steps taken to produce bug:
This could be done for minimum value as well.
Attachment: numscale.png
From dam...@gmail.com on March 18, 2014 08:07:22
Add backend validation?
From arnold.k...@gmail.com on March 18, 2014 19:20:45
That's odd as I did try to prevent that case :O If you see FeedbackAbstractResponseDetails if you see the code for saving numscale answers it has this:
double numscaleAnswer = Double.parseDouble(answer[0]); if (numscaleAnswer < minScale) { numscaleAnswer = minScale; } else if (numscaleAnswer > maxScale) { numscaleAnswer = maxScale; }
so that's should have became 5..
From dam...@gmail.com on March 18, 2014 20:29:06
Are we missing a test case somewhere? Probably cannot test at UI level, but should be tested at a lower level.
From lwl1991 on March 19, 2014 21:55:14
In the check, maxScale is taken from the hidden input value in the form, which is sent from the client side. It can be edited by manipulating the DOM, and could thus pass the check. Instead, maxScale should be taken from the respective questionDetails which is on the server side when performing a check.
From arnold.k...@gmail.com on March 21, 2014 00:40:19
yeah, you're right. Opened an issue for it ( issue 1744 )
Summary: NUMSCALE question: Strengthen step validation for question creation/submission (was: Strengthen validation for NUMSCALE feedback question creation/submission)
From arnold.k...@gmail.com on January 27, 2014 16:48:59
Currently, the create/submit forms does not enforce that: 1) The range is divisible by the step (warning is shown but not enforced) 2) The submitted value is one of the possible values according to the step
This is because of difficulties in reliably checking whether or not the input is in accordance to the two rules above. The difficulty is caused by float precision problems in javascript.
A workaround needs to be found and the validation rules enforced.
Original issue: http://code.google.com/p/teammatespes/issues/detail?id=1563