Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7f964cf
)
MDL-43621 badges: Fix has_awards() result when deleted users are the only recipients...
author
Yuliya Bozhko
<yuliya.bozhko@totaralms.com>
Wed, 15 Jan 2014 03:24:37 +0000
(16:24 +1300)
committer
Yuliya Bozhko
<yuliya.bozhko@totaralms.com>
Wed, 15 Jan 2014 03:24:37 +0000
(16:24 +1300)
lib/badgeslib.php
patch
|
blob
|
blame
|
history
diff --git
a/lib/badgeslib.php
b/lib/badgeslib.php
index
78425a0
..
0d1f928
100644
(file)
--- a/
lib/badgeslib.php
+++ b/
lib/badgeslib.php
@@
-331,10
+331,11
@@
class badge {
*/
public function has_awards() {
global $DB;
- if ($DB->record_exists('badge_issued', array('badgeid' => $this->id))) {
- return true;
- }
- return false;
+ $awarded = $DB->record_exists_sql('SELECT b.uniquehash
+ FROM {badge_issued} b INNER JOIN {user} u ON b.userid = u.id
+ WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $this->id));
+
+ return $awarded;
}
/**