improved countdown

This commit is contained in:
fbsanchez 2019-06-26 16:23:54 +02:00
parent f681809f7b
commit 58483e8748
1 changed files with 7 additions and 6 deletions

View File

@ -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;
}