MDL-44288 qtype_calculatedsimple fix validation notice.

The notice happend if you clicked Save changes before Find the wild
cards {x..} present in the correct answer formulas.
This commit is contained in:
Tim Hunt 2014-02-20 11:44:28 +00:00
parent ec4c8161a4
commit dfcaa2450c

View File

@ -585,7 +585,12 @@ class qtype_calculatedsimple_edit_form extends qtype_calculated_edit_form {
public function validation($data, $files) {
$errors = parent::validation($data, $files);
$numbers = $data['number'];
if (array_key_exists('number', $data)) {
$numbers = $data['number'];
} else {
$numbers = array();
}
foreach ($numbers as $key => $number) {
if (! is_numeric($number)) {
if (stristr($number, ',')) {