MDL-18293 removed obsoleted checking of return values from insert and update_record + unused strings cleanup

This commit is contained in:
skodak 2009-06-13 17:55:51 +00:00
parent a8c31db2a3
commit 0bcf8b6f0d
10 changed files with 21 additions and 83 deletions

View file

@ -137,15 +137,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
if ($oldanswer = array_shift($oldanswers)) { // Existing answer, so reuse it
$answer->id = $oldanswer->id;
if (! $DB->update_record("question_answers", $answer)) {
$result->error = "Could not update quiz answer! (id=$answer->id)";
return $result;
}
$DB->update_record("question_answers", $answer);
} else { // This is a completely new answer
if (! $answer->id = $DB->insert_record("question_answers", $answer)) {
$result->error = "Could not insert quiz answer!";
return $result;
}
$answer->id = $DB->insert_record("question_answers", $answer);
}
// Set up the options object
@ -165,15 +159,9 @@ class question_numerical_qtype extends question_shortanswer_qtype {
// Save options
if (isset($options->id)) { // reusing existing record
if (! $DB->update_record('question_numerical', $options)) {
$result->error = "Could not update quiz numerical options! (id=$options->id)";
return $result;
}
$DB->update_record('question_numerical', $options);
} else { // new options
if (! $DB->insert_record('question_numerical', $options)) {
$result->error = "Could not insert quiz numerical options!";
return $result;
}
$DB->insert_record('question_numerical', $options);
}
}
// delete old answer records