Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit efa9b7fa01ef37de6d0fb226c7797e87c0c86ecd 1 parent 6babaf0
kaipe authored
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]) {
Please sign in to comment.
Something went wrong with that request. Please try again.