]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed a bug that was reported by James Balfour:
authorkaipe <kaipe>
Mon, 17 Jan 2005 20:14:16 +0000 (20:14 +0000)
committerkaipe <kaipe>
Mon, 17 Jan 2005 20:14:16 +0000 (20:14 +0000)
Numerical/Calculated questions failed to grade negative responses on questions with units.

mod/quiz/questiontypes/numerical/questiontype.php

index 5afbd93d7030b9e3c9d45af277f6693f53d5200e..b6e519da1c23f67683dcdaca414f5d5f0def2b6d 100644 (file)
@@ -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]) {