Commit 4b8edb03 by Jansa Jose

Notification Pagination Fixx

parent 787233f1
...@@ -5180,30 +5180,22 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5180,30 +5180,22 @@ print_r(date('H:i',$ms));exit();*/
$start = 0; $start = 0;
$page_no = 0; $page_no = 0;
} }
$notificationResult = $this->Webservice_model->get_doctor_notification_list($authtoken->doctor_id, 0, 0);
$result = $this->Webservice_model->get_doctor_notification_list($authtoken->doctor_id,$start,$per_page); $result = $this->Webservice_model->get_doctor_notification_list($authtoken->doctor_id,$start,$per_page);
$count = $this->Webservice_model->get_doctor_notification_list_unread_count($authtoken->doctor_id); $count = $this->Webservice_model->get_doctor_notification_list_unread_count($authtoken->doctor_id);
if($count){ if($count){
$unread_count = $count->count; $total_count = $count->count;
}else{ }else{
$unread_count = 0; $total_count = 0;
} }
$notifArray = array();
if($notificationResult != false){ if($result != false){
$total_count = count($notificationResult); $total = count($result);
}else{ }else{
$total_count = 0; $total = 0;
} }
if($total >= $per_page){
$notifArray = array(); $totalPages = (int)($total / $per_page);
// if($result != false){
// $total = count($result);
// }else{
// $total = 0;
// }
if($total_count >= $per_page){
$totalPages = (int)($total_count / $per_page);
} }
else{ else{
$totalPages = 1; $totalPages = 1;
...@@ -5220,18 +5212,18 @@ print_r(date('H:i',$ms));exit();*/ ...@@ -5220,18 +5212,18 @@ print_r(date('H:i',$ms));exit();*/
$res = array( $res = array(
'status'=>'success', 'status'=>'success',
'data'=>array('unread_count'=>$unread_count,'notifications'=>$notifArray), 'data'=>array('unread_count'=>$total_count,'notifications'=>$notifArray),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total_count, 'total' => $total,
'current_page' =>$currentpage+1, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
}else{ }else{
$res = array( $res = array(
'status'=>'success', 'status'=>'success',
'data'=>array('unread_count'=>$unread_count,'notifications'=>[]), 'data'=>array('unread_count'=>$total_count,'notifications'=>[]),
'meta' => array('total_pages' => $totalPages, 'meta' => array('total_pages' => $totalPages,
'total' => $total_count, 'total' => $total,
'current_page' =>$currentpage+1, 'current_page' =>$currentpage+1,
'per_page' => $per_page) 'per_page' => $per_page)
); );
......
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