Skip to content

Commit

Permalink
MDL-62384 core_rating: Move WHERE clauses to JOIN
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed May 11, 2018
1 parent a339908 commit 38e6852
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rating/classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ public static function get_sql_join($alias, $component, $ratingarea, $itemidjoin

// Join the rating table with the specified alias and the relevant join params.
$join = "LEFT JOIN {rating} {$alias} ON ";
$join .= "{$alias}.userid = :ratinguserid{$count} AND ";
$join .= "{$alias}.component = :ratingcomponent{$count} AND ";
$join .= "{$alias}.ratingarea = :ratingarea{$count} AND ";
$join .= "{$alias}.itemid = {$itemidjoin}";

// Match against the specified user.
$userwhere = "{$alias}.userid = :ratinguserid{$count}";
$userwhere = "{$alias}.id IS NOT NULL";

$params = [
'ratingcomponent' . $count => $component,
Expand Down

0 comments on commit 38e6852

Please sign in to comment.