fix: [sync] Undefined index when pushing sightings

pull/7079/head
Jakub Onderka 2021-02-24 09:47:58 +01:00
parent 0ac351a462
commit bb1be01293
1 changed files with 3 additions and 3 deletions

View File

@ -754,16 +754,16 @@ class Server extends AppModel
}
if ($all) {
if ($scope === 'sightings') {
// Used when pushing: return just eventUuids that has sightings newer than remote server
$this->Event = ClassRegistry::init('Event');
$localEvents = $this->Event->find('list', array(
'recursive' => -1,
'fields' => array('Event.uuid', 'Event.sighting_timestamp'),
'conditions' => array('Event.uuid' => array_column($eventArray, 'uuid'))
));
$eventUuids = array();
$eventUuids = [];
foreach ($eventArray as $event) {
if (!isset($localEvents[$event['uuid']]) && $localEvents[$event['uuid']] > $event['sighting_timestamp']) {
if (isset($localEvents[$event['uuid']]) && $localEvents[$event['uuid']] > $event['sighting_timestamp']) {
$eventUuids[] = $event['uuid'];
}
}