Merge branch 'ent-4256-cuenta-atras' into 'develop'

improved countdown

See merge request artica/pandorafms!2546
This commit is contained in:
Daniel Rodriguez 2019-06-26 17:00:12 +02:00
commit 6f4ccff8b2
1 changed files with 7 additions and 6 deletions

View File

@ -68,15 +68,16 @@ if (is_ajax()) {
if ($refresh_contact) { if ($refresh_contact) {
$id_agente = get_parameter('id_agente', 0); $id_agente = get_parameter('id_agente', 0);
if ($id_agente > 0) { if ($id_agente > 0) {
$d = db_get_row( $last_contact = db_get_value_sql(
'tagente', sprintf(
'id_agente', 'SELECT intervalo - (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(IF(ultimo_contacto > ultimo_contacto_remoto, ultimo_contacto, ultimo_contacto_remoto)))
$id_agente FROM `tagente`
WHERE id_agente = %d ',
$id_agente
)
); );
$progress = agents_get_next_contact($id_agente); $progress = agents_get_next_contact($id_agente);
$last_contact = floor(($d['intervalo'] * (100 - $progress) / 100));
if ($progress < 0 || $progress > 100) { if ($progress < 0 || $progress > 100) {
$progress = 100; $progress = 100;
} }