Skip to content

Commit

Permalink
Fixed a bug that was reported by James Balfour:
Browse files Browse the repository at this point in the history
Numerical/Calculated questions failed to grade negative responses on questions with units.
  • Loading branch information
kaipe committed Jan 17, 2005
1 parent 6babaf0 commit efa9b7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mod/quiz/questiontypes/numerical/questiontype.php
Expand Up @@ -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]) {
Expand Down

0 comments on commit efa9b7f

Please sign in to comment.