Commit 7f7a3ef5 by Jansa Jose

dc

parent 726a7385
...@@ -456,6 +456,9 @@ class Webservice_model extends CI_Model { ...@@ -456,6 +456,9 @@ class Webservice_model extends CI_Model {
foreach ($mechData as $key => $value) { foreach ($mechData as $key => $value) {
$mechData[$key]['distance'] = round((float)$value['distance'],2); $mechData[$key]['distance'] = round((float)$value['distance'],2);
$mechData[$key]['review'] = []; $mechData[$key]['review'] = [];
$mechData[$key]['total_review'] = 0;
$mechData[$key]['avg_rate'] = 0;
$this->db->order_by('id','DESC'); $this->db->order_by('id','DESC');
$this->db->limit('2','0'); $this->db->limit('2','0');
$mechRvw = $this->db->get_where('mechanic_rating',array('mechanic_id'=>$value['mechanic_id'],'status'=>'1')); $mechRvw = $this->db->get_where('mechanic_rating',array('mechanic_id'=>$value['mechanic_id'],'status'=>'1'));
...@@ -465,8 +468,10 @@ class Webservice_model extends CI_Model { ...@@ -465,8 +468,10 @@ class Webservice_model extends CI_Model {
$rating = $this->db->query("SELECT COUNT(id) AS count, round(AVG(rate),2) AS rating $rating = $this->db->query("SELECT COUNT(id) AS count, round(AVG(rate),2) AS rating
FROM mechanic_rating FROM mechanic_rating
WHERE mechanic_id='".$value['mechanic_id']."'"); WHERE mechanic_id='".$value['mechanic_id']."'");
$mechData[$key]['total_review'] = (!empty($rating) && !empty($rating = $rating->row_array()))?$rating['count']:'0'; if(!empty($rating) && !empty($rating = $rating->row_array())){
$mechData[$key]['avg_rate'] = (!empty($rating) && !empty($rating = $rating->row_array()))?$rating['rating']:'0'; $mechData[$key]['total_review'] =$rating['count'];
$mechData[$key]['avg_rate'] = $rating['rating'];
}
} }
if($type == 0){ if($type == 0){
$respArr = $this->getNearMechanicsDetails($mechData,$issue_cat_id); $respArr = $this->getNearMechanicsDetails($mechData,$issue_cat_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment