public static function sendNumberNextAndroid($transaction_number, $diff)
 {
     $priority_queue = PriorityQueue::find($transaction_number);
     if ($priority_queue) {
         $user_id = $priority_queue->user_id;
         $priority_number = $priority_queue->priority_number;
         $queue_platform = $priority_queue->queue_platform;
         $email = $priority_queue->email;
         $terminal_id = TerminalTransaction::terminalId($transaction_number);
         $terminal_name = $terminal_id != 0 ? Terminal::name($terminal_id) : '';
         $business_id = $terminal_id != 0 ? Business::getBusinessIdByTerminalId($terminal_id) : 0;
         $business_name = $business_id != 0 ? Business::name($business_id) : '';
         $waiting_time = Analytics::getWaitingTime($business_id);
         $estimated_time = Helper::millisecondsToHMSFormat($waiting_time);
         $message = "Your number ({$priority_number}) will be called in approximately {$estimated_time}. ";
         if ($diff == 1) {
             $message .= "There is currently {$diff} person ahead of you at the {$terminal_name} at {$business_name}.";
         } else {
             $message .= "There are currently {$diff} people ahead of you at the {$terminal_name} at {$business_name}.";
         }
         if ($queue_platform != 'web' && $queue_platform != 'specific') {
             $gcm_token = User::gcmToken($user_id);
             if ($gcm_token) {
                 Notifier::sendAndroid($gcm_token, $message);
             }
         } else {
             if (($queue_platform == 'web' || $queue_platform == 'specific') && $email != null) {
                 $user = User::searchByEmail($email);
                 $gcm_token = $user ? User::gcmToken($user['user_id']) : null;
                 if ($gcm_token) {
                     Notifier::sendAndroid($gcm_token, $message);
                 }
             }
         }
     }
 }
 public static function getAverageTimeFromActionByBusinessId($action1, $action2, $business_id, $startdate, $enddate)
 {
     return Helper::millisecondsToHMSFormat(Analytics::getAverageTimeValueFromActionByBusinessId($action1, $action2, $business_id, $startdate, $enddate));
 }