Skip to content

Commit

Permalink
Merge branch 'MDL-79639_402_STABLE' of https://github.com/marxjohnson…
Browse files Browse the repository at this point in the history
…/moodle into MOODLE_402_STABLE
  • Loading branch information
HuongNV13 committed Oct 30, 2023
2 parents be729eb + 6a9e714 commit 8186259
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions question/classes/statistics/responses/analysis_for_question.php
Expand Up @@ -208,15 +208,21 @@ public function cache($qubaids, $whichtries, $questionid, $calculationtime = nul

$transaction = $DB->start_delegated_transaction();

$DB->delete_records_select('question_response_count',
'analysisid IN (
SELECT id
FROM {question_response_analysis}
WHERE hashcode= ? AND whichtries = ? AND questionid = ?
)', [$qubaids->get_hash_code(), $whichtries, $questionid]);

$DB->delete_records('question_response_analysis',
['hashcode' => $qubaids->get_hash_code(), 'whichtries' => $whichtries, 'questionid' => $questionid]);
$analysisids = $DB->get_fieldset_select(
'question_response_analysis',
'id',
'hashcode = ? AND whichtries = ? AND questionid = ?',
[
$qubaids->get_hash_code(),
$whichtries,
$questionid,
]
);
if (!empty($analysisids)) {
[$insql, $params] = $DB->get_in_or_equal($analysisids);
$DB->delete_records_select('question_response_count', 'analysisid ' . $insql, $params);
$DB->delete_records_select('question_response_analysis', 'id ' . $insql, $params);
}

foreach ($this->get_variant_nos() as $variantno) {
foreach ($this->get_subpart_ids($variantno) as $subpartid) {
Expand Down

0 comments on commit 8186259

Please sign in to comment.