Browse files

Fixed a bug that was reported by James Balfour:

Numerical/Calculated questions failed to grade negative responses on questions with units.
  • Loading branch information...
1 parent 6babaf0 commit efa9b7fa01ef37de6d0fb226c7797e87c0c86ecd kaipe committed Jan 17, 2005
Showing with 1 addition and 1 deletion.
  1. +1 −1 mod/quiz/questiontypes/numerical/questiontype.php
View
2 mod/quiz/questiontypes/numerical/questiontype.php
@@ -163,7 +163,7 @@ function grade_response($question, $nameprefix, $addedanswercondition='') {
unset($responsenum); // Answer is not numeric
}
} else if (ereg(
- '^(([0-9]+(\\.[0-9]*)?|[.][0-9]+)([eE][-+]?[0-9]+)?)([^0-9].*)?$',
+ '^([+-]?([0-9]+(\\.[0-9]*)?|[.][0-9]+)([eE][-+]?[0-9]+)?)([^0-9].*)?$',
$responsenum, $responseparts)) {
$responsenum = (float)$responseparts[1];
if ($responseparts[5]) {

0 comments on commit efa9b7f

Please sign in to comment.