Skip to content

Commit

Permalink
MDL-84085 mod_h5pactivity: account for missing ra table join alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Jan 28, 2025
1 parent bcf06a0 commit 4170444
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mod/h5pactivity/classes/local/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ public function get_active_users_join(bool $allpotentialusers = false, $currentg

// We want to present all potential users.
$capjoin = get_enrolled_with_capabilities_join($context, '', 'mod/h5pactivity:view', $currentgroup);

if ($capjoin->cannotmatchanyrows) {
return $capjoin;
}
Expand All @@ -368,11 +367,13 @@ public function get_active_users_join(bool $allpotentialusers = false, $currentg
return $capjoin;
}

$capjoin = new sql_join(
$capjoin->joins . "\n LEFT " . str_replace('ra', 'reviewer', $reviewersjoin->joins),
$capjoin->wheres . " AND reviewer.userid IS NULL",
$capjoin->params
);
if (str_contains($reviewersjoin->joins, 'ra')) {
$capjoin = new sql_join(
$capjoin->joins . "\n LEFT " . str_replace('ra', 'reviewer', $reviewersjoin->joins),
$capjoin->wheres . " AND reviewer.userid IS NULL",
$capjoin->params
);
}

if ($allpotentialusers) {
return $capjoin;
Expand Down

0 comments on commit 4170444

Please sign in to comment.