mirror of
https://github.com/moodle/moodle.git
synced 2025-04-27 19:33:16 +02:00
fix MDL-13047 in which an invalid SQL query was run if no attempts were foudn to match the conditions of the required report
This commit is contained in:
parent
0c78faaa1c
commit
ab327964e7
@ -193,15 +193,24 @@
|
||||
$groupby = 'userid';
|
||||
$records = hotpot_get_records_groupby($function, $fieldnames, $table, $select, $groupby);
|
||||
|
||||
$ids = array();
|
||||
foreach ($records as $record) {
|
||||
$ids[] = $record->clickreportid;
|
||||
$select = '';
|
||||
if ($records) {
|
||||
$ids = array();
|
||||
foreach ($records as $record) {
|
||||
$ids[] = $record->clickreportid;
|
||||
}
|
||||
if (count($ids)) {
|
||||
$select = "a.clickreportid IN (".join(',', $ids).")";
|
||||
}
|
||||
}
|
||||
$select = "a.clickreportid IN (".join(',', $ids).")";
|
||||
}
|
||||
|
||||
// pick out last attempt in each clickreport series
|
||||
$cr_attempts = hotpot_get_records_groupby('MAX', array('timefinish', 'id'), $table, $select, 'clickreportid');
|
||||
if ($select) {
|
||||
$cr_attempts = hotpot_get_records_groupby('MAX', array('timefinish', 'id'), $table, $select, 'clickreportid');
|
||||
} else {
|
||||
$cr_attempts = array();
|
||||
}
|
||||
|
||||
$fields = 'a.*, u.firstname, u.lastname, u.picture';
|
||||
if ($mode=='click') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user