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
This commit is contained in:
mattf
2018-03-24 03:13:58 +00:00
parent 7cffaee1ed
commit 92f50905e2
3 changed files with 11 additions and 8 deletions
@@ -1,7 +1,7 @@
<?php
# AST_CLOSERstats.php
#
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> 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";}
@@ -1,7 +1,7 @@
<?php
# AST_CLOSERstats_v2.php
#
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> 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";}
+3 -2
View File
@@ -1,7 +1,7 @@
<?php
# user_stats.php
#
# Copyright (C) 2017 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2018 Matt Florell <vicidial@gmail.com> 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;