From 58483e87487cf7e59286afb0798ecf30d05d7fe5 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 26 Jun 2019 16:23:54 +0200 Subject: [PATCH] improved countdown --- pandora_console/operation/agentes/ver_agente.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 5f7f29f916..b9b2a2128d 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -68,15 +68,16 @@ if (is_ajax()) { if ($refresh_contact) { $id_agente = get_parameter('id_agente', 0); if ($id_agente > 0) { - $d = db_get_row( - 'tagente', - 'id_agente', - $id_agente + $last_contact = db_get_value_sql( + sprintf( + 'SELECT intervalo - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto))) + FROM `tagente` + WHERE id_agente = %d ', + $id_agente + ) ); $progress = agents_get_next_contact($id_agente); - $last_contact = floor(($d['intervalo'] * (100 - $progress) / 100)); - if ($progress < 0 || $progress > 100) { $progress = 100; }