From cb07e7aa419022424998990b8a9806fd51d0230e Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 17 Oct 2018 18:27:32 +0530 Subject: [PATCH] SCHEDULAE --- api/application/config/constants.php | 2 +- api/application/controllers/PD_Controller.php | 29 +++---------------- api/application/models/PD_Model.php | 3 +- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 20af1c94..a92fee1a 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // define login route name for token verification //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'loadFullTemplate'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'updatePDMaster'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index e403be91..16065c2b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -449,18 +449,19 @@ class PD_Controller extends REST_Controller { */ public function updatePDMaster_post() { - $pd_details = $this->post('pd_details'); + $pd_details = $this->post('records'); + //print_r($pd_details); $where_condition_array = array('pd_id' => $pd_details['pd_id']); $pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array); - if($records['pd_status'] == TRIGGERED) + if($pd_details['pd_status'] == TRIGGERED) { // Create entries on `t_pd_category_weightage` table from Template Category weightage } if($pd_id_modified != null || $pd_id_modified != '' && $count != 0) { - PDALERTS::pdnotification($pd_id); + PDALERTS::pdnotification($pd_details['pd_id']); $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = true; @@ -686,28 +687,6 @@ class PD_Controller extends REST_Controller { */ public function schdulePD_post() { - - $records['fk_pd_id'] = 40; - $fields = array('fk_pd_template_id'); - $where_condition_array = array('pd_id'=>$records['fk_pd_id']); - $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTRIGGER); - //print_r($res_array); - if(count($res_array)) - { - $template_id = $res_array[0]['fk_pd_template_id']; - echo $template_id; - $fields = array('fk_question_category_id','weightage'); - $where_condition_array = array('fk_template_id'=>$template_id); - $res_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,TEMPLATECATEGORYWEIGHTAGE); - //print_r($res_array); - - foreach($res_array as $key => $category) - { - $temp_data = array('fk_pd_id'=>$records['fk_pd_id'],'fk_category_id'=>$category['fk_question_category_id'],'pd_category_weightage'=>$category['weightage']); - $this->PD_Model->saveRecords($temp_data,PDCATEGORYWEIGHTAGE); - } - } - //die(); $records = $this->post('records'); if($records['schedule_time'] != "" || $records['schedule_time'] != null) { diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 17040f36..2928e0f6 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -284,10 +284,11 @@ class PD_Model extends SPARQ_Model { foreach($categories as $category_key => $category) { - $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive'); + $this->db->SELECT('QUESTIONS.question_id,QUESTIONS.question,TEMPLATEQUESTION.template_question_id, TEMPLATEQUESTION.fk_template_id, TEMPLATEQUESTION.fk_question_id, TEMPLATEQUESTION.question_weightage, TEMPLATEQUESTION.question_answerable_by,TEMPLATEQUESTION.fk_template_question_category_id, TEMPLATEQUESTION.isactive,QUESTIONANSWERTYPE.answer_type_name'); //$this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->FROM(TEMPLATEQUESTION.' as TEMPLATEQUESTION'); $this->db->JOIN(QUESTIONS.' as QUESTIONS','TEMPLATEQUESTION.fk_question_id = QUESTIONS.question_id','LEFT'); + $this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATEQUESTION.fk_createdby = USERPROFILE.userid','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATEQUESTION.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->WHERE('TEMPLATEQUESTION.fk_template_question_category_id',$category['fk_question_category_id']);