From: kaipe Date: Mon, 17 Jan 2005 20:14:16 +0000 (+0000) Subject: Fixed a bug that was reported by James Balfour: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=efa9b7fa01ef37de6d0fb226c7797e87c0c86ecd;p=moodle.git Fixed a bug that was reported by James Balfour: Numerical/Calculated questions failed to grade negative responses on questions with units. --- diff --git a/mod/quiz/questiontypes/numerical/questiontype.php b/mod/quiz/questiontypes/numerical/questiontype.php index 5afbd93d70..b6e519da1c 100644 --- a/mod/quiz/questiontypes/numerical/questiontype.php +++ b/mod/quiz/questiontypes/numerical/questiontype.php @@ -163,7 +163,7 @@ class quiz_numerical_qtype extends quiz_shortanswer_qtype { 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]) {