Permalink
Browse files

MDL-51110 badges: prevent duplicate award of badges

Previously duplicate users could be returned when they had
done duplicate badge criteria - this would lead to a duplicate
constraint being hit as they were attempted to be awarded twice.
  • Loading branch information...
danpoltawski committed Aug 13, 2015
1 parent 7da2ed7 commit 0571f136e68492d2639c5c6c16cdc09e662e7604
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/badgeslib.php
View
@@ -463,7 +463,7 @@ public function review_all_criteria() {
$wheresql = ' WHERE u.id ' . $earnedsql;
}
list($enrolledsql, $enrolledparams) = get_enrolled_sql($this->get_context(), 'moodle/badges:earnbadge', 0, true);
$sql = "SELECT u.id
$sql = "SELECT DISTINCT u.id
FROM {user} u
{$extrajoin}
JOIN ({$enrolledsql}) je ON je.id = u.id " . $wheresql . $extrawhere;

0 comments on commit 0571f13

Please sign in to comment.