Fixed a bug that was reported by James Balfour:

Numerical/Calculated questions failed to grade negative responses on questions with units.
This commit is contained in:
kaipe
2005-01-17 20:14:16 +00:00
parent 6babaf002d
commit efa9b7fa01
@@ -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]) {