Skip to content

Commit

Permalink
apply quiz scope when joining on usercodes table to prevent duplicate…
Browse files Browse the repository at this point in the history
… results by sort key.
  • Loading branch information
stopfstedt committed Jan 17, 2025
1 parent a586c71 commit 449170f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion report/grading/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ protected function get_usage_ids_where_question_in_state($summarystate, $slot,
) as tcreated";
$orderby = "tcreated";
} else if ($orderby === 'usercode') {
$qubaids->from .= " JOIN {local_quizanon_usercodes} lqau ON lqau.userid = quiza.userid";
$qubaids->from
.= " JOIN {local_quizanon_usercodes} lqau ON lqau.userid = quiza.userid AND quiza.quiz = lqau.quizid";
$orderby = 'lqau.code';
}
return $dm->load_questions_usages_where_question_in_state($qubaids, $summarystate,
Expand Down

0 comments on commit 449170f

Please sign in to comment.