From 92f50905e2db8552baf8207d1458294a335dd57c Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 24 Mar 2018 03:13:58 +0000 Subject: [PATCH] Fix for user time calculation in inbound and user stats reports, subtracted queue_seconds git-svn-id: svn://192.168.202.10@2949 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php | 7 ++++--- agc_2-X/trunk/www/vicidial/AST_CLOSERstats_v2.php | 7 ++++--- agc_2-X/trunk/www/vicidial/user_stats.php | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php index 64e54c96..ecca9c99 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 60619-1714 - Added variable filtering to eliminate SQL injection attack threat @@ -59,6 +59,7 @@ # 170409-1559 - Added IP List validation code # 170829-0040 - Added screen color settings # 171012-2015 - Fixed javascript/apache errors with graphs +# 180323-2306 - Fix for user time calculation, subtracted queue_seconds # $startMS = microtime(); @@ -2665,10 +2666,10 @@ $max_timehms=1; $max_average=1; $graph_stats=array(); -$stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; +$stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec-queue_seconds),avg(length_in_sec-queue_seconds) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; if ($DID=='Y') { - $stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; + $stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec-queue_seconds),avg(length_in_sec-queue_seconds) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats_v2.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats_v2.php index ccb43d63..ee5f1a58 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats_v2.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats_v2.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGES: # 60619-1714 - Added variable filtering to eliminate SQL injection attack threat @@ -63,6 +63,7 @@ # 170409-1559 - Added IP List validation code # 170829-0040 - Added screen color settings # 171012-2015 - Fixed javascript/apache errors with graphs +# 180323-2307 - Fix for user time calculation, subtracted queue_seconds # $startMS = microtime(); @@ -3010,10 +3011,10 @@ $max_calls=1; $max_timehms=1; $max_average=1; $graph_stats=array(); -$stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $calldate_call_time_clause and campaign_id IN($group_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; +$stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec-queue_seconds),avg(length_in_sec-queue_seconds) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $calldate_call_time_clause and campaign_id IN($group_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; if ($DID=='Y') { - $stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $calldate_call_time_clause and uniqueid IN($unid_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; + $stmt="select ".$vicidial_closer_log_table.".user,full_name,count(*),sum(length_in_sec-queue_seconds),avg(length_in_sec-queue_seconds) from ".$vicidial_closer_log_table.",vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' $calldate_call_time_clause and uniqueid IN($unid_SQL) and ".$vicidial_closer_log_table.".user is not null and length_in_sec is not null and ".$vicidial_closer_log_table.".user=vicidial_users.user group by ".$vicidial_closer_log_table.".user;"; } $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index aaecb2ba..286c5b82 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2018 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -56,6 +56,7 @@ # 170228-1626 - Change to display emergency manager logout note # 170409-1555 - Added IP List validation code # 170412-2150 - Added park_rpt display option +# 180323-2308 - Fix for user time calculation, subtracted queue_seconds # $startMS = microtime(); @@ -696,7 +697,7 @@ else $o++; } - $stmt="SELECT count(*),status, sum(length_in_sec) from ".$vicidial_closer_log_table." where user='" . mysqli_real_escape_string($link, $user) . "' and call_date >= '" . mysqli_real_escape_string($link, $begin_date) . " 0:00:01' and call_date <= '" . mysqli_real_escape_string($link, $end_date) . " 23:59:59' $query_call_status group by status order by status"; + $stmt="SELECT count(*),status, sum(length_in_sec-queue_seconds) from ".$vicidial_closer_log_table." where user='" . mysqli_real_escape_string($link, $user) . "' and call_date >= '" . mysqli_real_escape_string($link, $begin_date) . " 0:00:01' and call_date <= '" . mysqli_real_escape_string($link, $end_date) . " 23:59:59' $query_call_status group by status order by status"; $rslt=mysql_to_mysqli($stmt, $link); $VCLstatuses_to_print = mysqli_num_rows($rslt); $o=0;