Skip to content

Commit

Permalink
Revert "fix: prevent unnecessary warning from appearing when editing …
Browse files Browse the repository at this point in the history
…an existing question and properly handle regrades"

This reverts commit 4848751.
  • Loading branch information
Pol Torrent i Soler committed Sep 16, 2024
1 parent 4848751 commit b59a58d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 37 deletions.
16 changes: 1 addition & 15 deletions edit_multianswerwiris_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


class qtype_multianswerwiris_edit_form extends qtype_wq_edit_form {

protected function definition_inner($mform) {
global $CFG;
parent::definition_inner($mform);
Expand All @@ -46,18 +47,3 @@ public function qtype() {
return 'multianswerwiris';
}
}

class qtype_multianswer_edit_form_helper extends qtype_multianswer_edit_form {
protected function definition_inner($mform) {
// Remove wiris particle from subquestion qtypes so the multianswer form does not think
// we are changing the qtypes when we are not actually doing it.
foreach ($this->savedquestiondisplay->options->questions as $subq) {
$qtype = $subq->qtype;
if (substr($qtype, -5) == 'wiris') {
$subq->qtype = substr($qtype, 0, strlen($qtype) - 5);
}
}

parent::definition_inner($mform);
}
}
21 changes: 0 additions & 21 deletions question.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,25 +392,4 @@ public function summarise_response(array $response) {
// data.
return get_string('contentnotviewable', 'qtype_multianswerwiris');
}


public function update_attempt_state_data_for_new_version(
question_attempt_step $oldstep,
question_definition $oldquestion
) {
// Save global state data to prevent it from being overwritten.
$qi = $oldstep->get_qt_var('_qi');
$gc = $oldstep->get_qt_var('_gc');

$result = parent::update_attempt_state_data_for_new_version($oldstep, $oldquestion);

if (isset($qi)) {
$result['_qi'] = $qi;
}
if (isset($gc)) {
$result['_gc'] = $gc;
}

return $result;
}
}
2 changes: 1 addition & 1 deletion questiontype.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function save_question($authorizedquestion, $form) {
public function create_editing_form($submiturl, $question, $category, $contexts, $formeditable) {
global $CFG;
require_once($CFG->dirroot . '/question/type/multianswerwiris/edit_multianswerwiris_form.php');
$wform = new qtype_multianswer_edit_form_helper($submiturl, $question, $category, $contexts, $formeditable);
$wform = $this->base->create_editing_form($submiturl, $question, $category, $contexts, $formeditable);
return new qtype_multianswerwiris_edit_form($wform, $submiturl, $question, $category, $contexts, $formeditable);
}

Expand Down

0 comments on commit b59a58d

Please sign in to comment.