From 716378f0742152f5d10c66e30500d26c163ee7cc Mon Sep 17 00:00:00 2001 From: alext Date: Tue, 5 Dec 2017 22:34:56 +0100 Subject: [PATCH] Only load the required events and not all the database records (for better performance). --- src/application/controllers/Backend_api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/application/controllers/Backend_api.php b/src/application/controllers/Backend_api.php index efa02893..ccc4fbb6 100644 --- a/src/application/controllers/Backend_api.php +++ b/src/application/controllers/Backend_api.php @@ -199,8 +199,8 @@ class Backend_api extends CI_Controller { // Get appointments $where_clause = [ $where_id => $this->input->post('record_id'), - //'start_datetime >=' => $this->input->post('start_date'), - //'end_datetime <=' => $this->input->post('end_date'), + 'DATE(start_datetime) >=' => $this->input->post('start_date'), + 'DATE(start_datetime) <=' => date('Y-m-d', strtotime($this->input->post('end_date') . ' +1 day')), 'is_unavailable' => FALSE ]; @@ -218,8 +218,8 @@ class Backend_api extends CI_Controller { { $where_clause = [ $where_id => $this->input->post('record_id'), - //'start_datetime >=' => $this->input->post('start_date'), - //'end_datetime <=' => $this->input->post('end_date'), + 'DATE(start_datetime) >=' => $this->input->post('start_date'), + 'DATE(start_datetime) <=' => date('Y-m-d', strtotime($this->input->post('end_date') . ' +1 day')), 'is_unavailable' => TRUE ];