From 14f4e356f570e480f7cf33531cfa11235b0718b8 Mon Sep 17 00:00:00 2001 From: velz Date: Thu, 18 Oct 2018 13:27:42 +0530 Subject: [PATCH] TEMPLATE AND PD2 --- api/application/config/constants.php | 2 +- api/application/models/Template_Management_Model.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 5802aa3b..d0b30948 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', 'getTemplateQuestionAnswers'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/models/Template_Management_Model.php b/api/application/models/Template_Management_Model.php index 658210cd..6820c923 100644 --- a/api/application/models/Template_Management_Model.php +++ b/api/application/models/Template_Management_Model.php @@ -103,6 +103,7 @@ class Template_Management_Model extends SPARQ_Model { // $this->db->JOIN(USERPROFILE.' as USERPROFILE','TEMPLATECATEGORYWEIGHTAGE.fk_createdby = USERPROFILE.userid','LEFT'); // $this->db->JOIN(USERPROFILE.' as USERPROFILE1','TEMPLATECATEGORYWEIGHTAGE.fk_updatedby = USERPROFILE1.userid','LEFT'); $this->db->WHERE('TEMPLATECATEGORYWEIGHTAGE.fk_template_id',$template_id); + $categories = $this->db->GET()->result_array(); if(count($categories)) @@ -120,6 +121,7 @@ class Template_Management_Model extends SPARQ_Model { // $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']); + $this->db->WHERE('TEMPLATEQUESTION.fk_template_id',$template_id); $questions = $this->db->GET()->result_array(); @@ -131,7 +133,8 @@ class Template_Management_Model extends SPARQ_Model { $this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage_id, TEMPLATEANSWERWEIGHTAGE.fk_template_question_id, TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id, TEMPLATEANSWERWEIGHTAGE.template_answer_weightage, TEMPLATEANSWERWEIGHTAGE.isactive'); $this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE'); $this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT'); - $this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']); + $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question['template_question_id']); + $answers = $this->db->GET()->result_array(); $questions[$answer_key]['answers'] = $answers; }