From afa7d73614afb6f371f480b89ea40c56a8afe521 Mon Sep 17 00:00:00 2001
From: jansa <jansa@techware.in>
Date: Tue, 23 Jul 2019 12:59:18 +0530
Subject: [PATCH] dc

---
 application/models/Webservice_model.php | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/application/models/Webservice_model.php b/application/models/Webservice_model.php
index fa086c8..dd31f11 100644
--- a/application/models/Webservice_model.php
+++ b/application/models/Webservice_model.php
@@ -456,8 +456,6 @@ class Webservice_model extends CI_Model {
     foreach ($mechData as $key => $value) {
       $mechData[$key]['distance'] = round((float)$value['distance'],2);
       $mechData[$key]['review'] = [];
-      $mechData[$key]['total_review'] = 0;
-      $mechData[$key]['avg_rate'] = 0;
 
       $this->db->order_by('id','DESC');
       $this->db->limit('2','0');
@@ -469,8 +467,8 @@ class Webservice_model extends CI_Model {
                   FROM mechanic_rating 
                   WHERE mechanic_id='".$value['mechanic_id']."'");
       if(!empty($rating) && !empty($rating = $rating->row_array())){
-        $mechData[$key]['total_review'] =$rating['count'];
-        $mechData[$key]['avg_rate'] = $rating['rating'];
+        $mechData[$key]['total_review'] =(empty($rating['count']))?'0':;
+        $mechData[$key]['avg_rate'] = (empty($rating['rating']))?0:(int)$rating['rating'];
       }
     }
     if($type == 0){
--
libgit2 0.27.1