diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 8d0def30..b79581e1 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', 'getEntityMasterInfo'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getAnswersForPD'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 86a06db6..1cc1a185 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -24,7 +24,7 @@ class Entity_Management_Controller extends REST_Controller { public function listAllEntites_get() { - $page = 0;$limit = 0;$sort = 'ASC';$entity_type_id = ''; + $page = 0;$limit = 0;$sort = 'ASC';$entity_type_id = '';$entity_id = ''; if($this->get('page')) { $page = $this->get('page'); } if($this->get('limit')){ $limit = $this->get('limit'); } diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index da4cafe3..ea774124 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -1177,7 +1177,7 @@ class PD_Controller extends REST_Controller { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $pd_detail_id; + $data['records'] = $answers; $this->response($data,REST_Controller::HTTP_OK); } else diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index e90fb274..78906937 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -341,17 +341,35 @@ class PD_Model extends SPARQ_Model { public function getAnswersForPD($question_id,$pd_id,$template_id,$category_id) { - $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,PDDETAIL.pd_detail_id'); + $pd_master_detials = $this->getPDMasterDetails($pd_id); + $this->db->SELECT('QUESTIONANSWERS.question_answer_id,QUESTIONANSWERS.answer,TEMPLATEANSWERWEIGHTAGE.template_answer_weightage,PDDETAIL.pd_detail_id,PDDETAIL.pd_anwer_image_title,PDDETAIL.pd_answer_image'); $this->db->FROM(TEMPLATEANSWERWEIGHTAGE.' as TEMPLATEANSWERWEIGHTAGE'); - $this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id','LEFT'); + $this->db->JOIN(TEMPLATEQUESTION." as TEMPLATEQUESTION","TEMPLATEANSWERWEIGHTAGE.fk_template_question_id = TEMPLATEQUESTION.template_question_id AND TEMPLATEQUESTION.fk_template_question_category_id = $category_id AND TEMPLATEQUESTION.fk_template_id = $template_id AND TEMPLATEQUESTION.fk_question_id = $question_id"); + $this->db->JOIN(QUESTIONANSWERS.' as QUESTIONANSWERS','TEMPLATEANSWERWEIGHTAGE.fk_question_answer_id = QUESTIONANSWERS.question_answer_id'); $this->db->JOIN(PDDETAIL.' as PDDETAIL',"QUESTIONANSWERS.question_answer_id = PDDETAIL.pd_answer_id AND PDDETAIL.fk_pd_id = $pd_id",'LEFT'); // $this->db->WHERE('QUESTIONANSWERS.fk_question_id',$question['question_id']); - $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question_id); + // $this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_question_id',$question_id); //$this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_question_category_id',$category_id); //$this->db->WHERE('TEMPLATEANSWERWEIGHTAGE.fk_template_id',$template_id); // $this->db->WHERE('PDDETAIL.fk_pd_id',$pdid); $answers = $this->db->GET()->result_array(); - print_r($answers); + + if(count($answers)) + { + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$pd_master_detials[0]['fk_lender_id']; + foreach($answers as $answer_key => $answer) + { + if($answer['pd_answer_image'] != "" || $answer['pd_answer_image'] != null) + { + $profilepics3path = 'pd'.$pd_master_detials[0]['pd_id'].'/'.$answer['pd_answer_image']; + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,'+30 minutes'); + $answers[$answer_key]['doc_url'] = $singed_uri; + } + } + + } + return $answers; + } /**