-
Bug
-
Resolution: Fixed
-
Minor
-
3.6.4, 3.7, 3.8
-
MOODLE_36_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
-
MOODLE_36_STABLE, MOODLE_37_STABLE
-
The sequence:
$quba = question_engine::make_questions_usage_by_activity('core_test', context_system::instance()); |
$quba->set_preferred_behaviour('interactive'); |
$slot = $this->quba->add_question($question, $maxmark); |
$quba->start_question($slot); |
question_engine::save_questions_usage_by_activity($quba); |
$quba->process_all_actions(time(), $postdata); |
question_engine::save_questions_usage_by_activity($quba); |
deoes not work as one would expect (first save creates a new the new usage structure in the DB, second save updates it. Instead, both calls to save will create a whole new structre in the DB.
In constrast, this code does work (updates the same usage structure twice:
$quba = question_engine::load_questions_usage_by_activity($qubaid); |
$quba->process_all_actions(time(), $postdata1); |
question_engine::save_questions_usage_by_activity($quba); |
$quba->process_all_actions(time(), $postdata2); |
question_engine::save_questions_usage_by_activity($quba); |
This is confusing and should just be fixed. I dont' believe anyone would be relying on the current behaviour, and it is currently causing huge confusion for Jim Kinsman in developer chat.