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.
This commit is contained in:
+1
-1
@@ -463,7 +463,7 @@ class badge {
|
||||
$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;
|
||||
|
||||
Reference in New Issue
Block a user