From 8ace2060a8c4b0ca2ea6ae7e195e94498a9b3d1b Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 26 Jun 2007 09:18:50 +0000 Subject: [PATCH] Fixing a few notices when there are no users --- grade/report/grader/index.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/grade/report/grader/index.php b/grade/report/grader/index.php index 6aaeb899fd..85074109b9 100644 --- a/grade/report/grader/index.php +++ b/grade/report/grader/index.php @@ -128,14 +128,21 @@ $numusers = count_records_sql($countsql); // print_object($users); // debug +if (empty($users)) { + $userselect = ''; + $users = array(); +} else { + $userselect = 'AND g.userid in ('.implode(',', array_keys($users)).')'; +} + + // phase 2 sql, we supply the userids in this query, and get all the grades // pulls out all the grades, this does not need to worry about paging $sql = "SELECT g.id, g.itemid, g.userid, g.finalgrade FROM {$CFG->prefix}grade_grades g, {$CFG->prefix}grade_items gi WHERE g.itemid = gi.id - AND gi.courseid = $courseid - AND g.userid in (".implode(",", array_keys($users)).")"; + AND gi.courseid = $courseid $userselect"; ///print_object($grades); //debug -- 2.39.5