Check for empty events before proceeding with the syncing (#531).
This commit is contained in:
parent
902485e2d3
commit
673ec82aa3
1 changed files with 17 additions and 15 deletions
|
@ -221,8 +221,11 @@ class Google extends CI_Controller {
|
|||
foreach ($events->getItems() as $event)
|
||||
{
|
||||
$results = $this->appointments_model->get_batch(['id_google_calendar' => $event->getId()]);
|
||||
if (count($results) == 0)
|
||||
{
|
||||
|
||||
if (!empty($results) || empty($event)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Record doesn't exist in E!A, so add the event now.
|
||||
$appointment = [
|
||||
'start_datetime' => date('Y-m-d H:i:s', strtotime($event->start->getDateTime())),
|
||||
|
@ -238,7 +241,6 @@ class Google extends CI_Controller {
|
|||
|
||||
$this->appointments_model->add($appointment);
|
||||
}
|
||||
}
|
||||
|
||||
$this->output
|
||||
->set_content_type('application/json')
|
||||
|
|
Loading…
Reference in a new issue