]> git.mjollnir.org Git - moodle.git/commitdiff
merged fix on wrong counter
authortoyomoyo <toyomoyo>
Wed, 6 Dec 2006 04:54:31 +0000 (04:54 +0000)
committertoyomoyo <toyomoyo>
Wed, 6 Dec 2006 04:54:31 +0000 (04:54 +0000)
user/index.php

index 9abdc74dd2ee601e47b0282194885433c7d222cb..df3203ddc973b31df921b94dd9dea20baff763a4 100644 (file)
     } else {
         $selectrole = " ";
     }
-    $select = 'SELECT u.id, u.username, u.firstname, u.lastname, u.email, u.city, u.country,
-        u.picture, u.lang, u.timezone, u.emailstop, u.maildisplay, ul.timeaccess AS lastaccess, r.hidden '; // s.lastaccess
-    //$select .= $course->enrolperiod?', s.timeend ':'';
+    $select = 'SELECT u.id, u.username, u.firstname, u.lastname, u.email, u.city, u.country, u.picture, u.lang, u.timezone, u.emailstop, u.maildisplay, ul.timeaccess AS lastaccess, r.hidden '; // s.lastaccess
+    $select .= $course->enrolperiod?', r.timeend ':'';
+
     $from   = "FROM {$CFG->prefix}user u INNER JOIN
     {$CFG->prefix}role_assignments r on u.id=r.userid LEFT OUTER JOIN
     {$CFG->prefix}user_lastaccess ul on (r.userid=ul.userid and ul.courseid = $course->id)"; 
         $sort = '';
     }
 
-    $matchcount = count_records_sql('SELECT COUNT(*) '.$from.$where.$wheresearch);
+    $matchcount = count_records_sql('SELECT COUNT(distinct u.id) '.$from.$where.$wheresearch);
 
     $table->initialbars($totalcount > $perpage);
     $table->pagesize($perpage, $matchcount);