Skip to content

Commit 6fb5782

Browse files
Count course errors regardless of course idnumber
1 parent 1e67bc0 commit 6fb5782

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

managecategory.php

+13-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
$courseamounts = $DB->get_record_sql('SELECT (COUNT(evalc.id) - COUNT(evalmanualc.id)) as autoevalcourses, ' .
8484
'COUNT(evalmanualc.id) as manualevalcourses, COUNT(ereqc.id) as requestcourses, ' .
85-
'(COUNT(*) - COUNT(COALESCE(ereqc.id, evalc.id))) as remainingcourses, COUNT(errors.id) as errorcourses ' .
85+
'(COUNT(*) - COUNT(COALESCE(ereqc.id, evalc.id))) as remainingcourses ' .
8686
'FROM {course} c ' .
8787
'JOIN {customfield_data} cfd ON cfd.instanceid = c.id AND cfd.fieldid = :semesterfieldid ' .
8888
'LEFT JOIN {' . dbtables::EVAL_REQUESTS_COURSES . '} ereqc ON ereqc.courseid = c.id ' .
@@ -92,12 +92,21 @@
9292
JOIN {' . dbtables::EVAL_VERANSTS . '} evalver1 ON evalver1.evalid = c1.evalid ' .
9393
"WHERE evalver1.state $inmanualsql " .
9494
') evalmanualc ON evalmanualc.courseid = c.id ' .
95-
'LEFT JOIN {' . dbtables::ERRORS . '} errors ON errors.courseid = c.id AND errors.timehandled IS NULL ' .
9695
"WHERE cfd.intvalue = :semester AND " .
9796
"c.idnumber <> '' AND " .
9897
"c.category $incatsql ", array_merge(['semesterfieldid' => $field->id, 'semester' => $data->semester], $params)
9998
);
10099

100+
$courseamountswithidnumber = $DB->get_record_sql('SELECT COUNT(errors.id) as errorcourses ' .
101+
'FROM {course} c ' .
102+
'JOIN {customfield_data} cfd ON cfd.instanceid = c.id AND cfd.fieldid = :semesterfieldid ' .
103+
'LEFT JOIN {' . dbtables::ERRORS . '} errors ON errors.courseid = c.id AND errors.timehandled IS NULL ' .
104+
"WHERE cfd.intvalue = :semester AND " .
105+
"c.category $incatsql ", array_merge(['semesterfieldid' => $field->id, 'semester' => $data->semester], $params)
106+
);
107+
108+
109+
101110
echo $OUTPUT->header();
102111

103112
/* @var \block_evasys_sync\output\renderer $renderer */
@@ -124,10 +133,10 @@
124133

125134
$table->setup();
126135

127-
if ($courseamounts->errorcourses) {
136+
if ($courseamountswithidnumber->errorcourses) {
128137
$table->add_data([
129138
html_writer::link(new moodle_url('/blocks/evasys_sync/managecategory_errors.php', ['id' => $id]),
130-
get_string('courses_with_errors', 'block_evasys_sync')), $courseamounts->errorcourses
139+
get_string('courses_with_errors', 'block_evasys_sync')), $courseamountswithidnumber->errorcourses
131140
], 'table-warning');
132141
}
133142

0 commit comments

Comments
 (0)