mirror of
https://github.com/nextcloud/integration_moodle.git
synced 2025-12-17 21:02:05 +01:00
refs #13 resist to missing timeaccess in recent items
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
This commit is contained in:
parent
d98e5a7f60
commit
eddf1fb5da
1 changed files with 5 additions and 5 deletions
|
|
@ -58,8 +58,8 @@ class MoodleAPIService {
|
|||
|
||||
// sort recent items by date DESC
|
||||
$a = usort($recentItems, function($a, $b) {
|
||||
$ta = $a['timeaccess'];
|
||||
$tb = $b['timeaccess'];
|
||||
$ta = $a['timeaccess'] ?? 0;
|
||||
$tb = $b['timeaccess'] ?? 0;
|
||||
return ($ta > $tb) ? -1 : 1;
|
||||
});
|
||||
|
||||
|
|
@ -91,13 +91,13 @@ class MoodleAPIService {
|
|||
}
|
||||
// sort upcoming events by date ASC
|
||||
$a = usort($upcomingEvents, function($a, $b) {
|
||||
$ta = $a['timestart'];
|
||||
$tb = $b['timestart'];
|
||||
$ta = $a['timestart'] ?? 0;
|
||||
$tb = $b['timestart'] ?? 0;
|
||||
return ($ta < $tb) ? -1 : 1;
|
||||
});
|
||||
|
||||
foreach ($upcomingEvents as $k => $upcomingEvent) {
|
||||
$upcomingEvents[$k]['time'] = $upcomingEvent['timestart'];
|
||||
$upcomingEvents[$k]['time'] = $upcomingEvent['timestart'] ?? 0;
|
||||
$upcomingEvents[$k]['type'] = 'event';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue