added AST_VDauto_dial ready_agents and waiting_calls stats average for one minute with timeonVDADall display

git-svn-id: svn://192.168.202.10@213 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-08-24 21:53:51 +00:00
parent 600dd65312
commit 517bd5bdf9
4 changed files with 121 additions and 10 deletions
+97 -7
View File
@@ -207,6 +207,7 @@ while($one_day_interval > 0)
{
$endless_loop=5760000; # 30 days minutes at XXX seconds per loop
$stat_count=1;
while($endless_loop > 0)
{
@@ -237,6 +238,7 @@ while($one_day_interval > 0)
@DBIPexistcalls=@MT;
@DBIPgoalcalls=@MT;
@DBIPmakecalls=@MT;
@DBIPlivecalls=@MT;
@DBIPclosercamp=@MT;
@DBIPomitcode=@MT;
@@ -405,6 +407,93 @@ while($one_day_interval > 0)
$event_string="$DBIPcampaign[$user_CIPct] $DBIPaddress[$user_CIPct]: Calls to place: $DBIPmakecalls[$user_CIPct] ($DBIPgoalcalls[$user_CIPct] - $DBIPexistcalls[$user_CIPct]) $MVT_msg";
&event_logger;
### Calculate campaign-wide agent waiting and calls waiting differential
### This is used by the AST_VDadapt script to see if the current dial_level
### should be changed at all
$total_agents=0;
$ready_agents=0;
$waiting_calls=0;
$stmtA = "SELECT count(*),status from vicidial_live_agents where campaign_id='$DBIPcampaign[$user_CIPct]' and last_update_time > '$halfminSQLdate' group by status;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$VCSagent_count = "$aryA[0]";
$VCSagent_status = "$aryA[1]";
$rec_count++;
if ($VCSagent_status =~ /READY|DONE/) {$ready_agents = ($ready_agents + $VCSagent_count);}
$total_agents = ($total_agents + $VCSagent_count);
}
$sthA->finish();
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where $campaign_query and status IN('LIVE');";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$waiting_calls = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
$stat_ready_agents[$user_CIPct][$stat_count] = $ready_agents;
$stat_waiting_calls[$user_CIPct][$stat_count] = $waiting_calls;
$stat_total_agents[$user_CIPct][$stat_count] = $total_agents;
$stat_it=20;
$ready_diff_total=0;
$waiting_diff_total=0;
$total_agents_total=0;
$ready_diff_avg=0;
$waiting_diff_avg=0;
$total_agents_avg=0;
$stat_differential=0;
if ($stat_count < 20)
{
$stat_it = $stat_count;
$stat_B = 1;
}
else
{
$stat_B = ($stat_count - 19);
}
$it=0;
while($it < $stat_it)
{
$it_ary = ($it + $stat_B);
$ready_diff_total = ($ready_diff_total + $stat_ready_agents[$user_CIPct][$it_ary]);
$waiting_diff_total = ($waiting_diff_total + $stat_waiting_calls[$user_CIPct][$it_ary]);
$total_agents_total = ($total_agents_total + $stat_total_agents[$user_CIPct][$it_ary]);
# $event_string="$stat_count $it_ary $stat_total_agents[$user_CIPct][$it_ary]|$stat_ready_agents[$user_CIPct][$it_ary]|$stat_waiting_calls[$user_CIPct][$it_ary]";
# &event_logger;
$it++;
}
if ($ready_diff_total > 0)
{$ready_diff_avg = ($ready_diff_total / $stat_it);}
if ($waiting_diff_total > 0)
{$waiting_diff_avg = ($waiting_diff_total / $stat_it);}
if ($total_agents_total > 0)
{$total_agents_avg = ($total_agents_total / $stat_it);}
$stat_differential = ($ready_diff_avg - $waiting_diff_avg);
$event_string="CAMPAIGN DIFFERENTIAL: $total_agents_avg $stat_differential ($ready_diff_avg - $waiting_diff_avg)";
&event_logger;
$stmtA = "UPDATE vicidial_campaign_stats SET differential_onemin='$stat_differential', agents_average_onemin='$total_agents_avg' where campaign_id='$DBIPcampaign[$user_CIPct]';";
$affected_rows = $dbhA->do($stmtA);
$user_CIPct++;
}
@@ -849,15 +938,15 @@ while($one_day_interval > 0)
$i=0;
foreach (@psoutput)
{
chomp($psoutput[$i]);
{
chomp($psoutput[$i]);
@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]);
@psline = split(/\/usr\/bin\/perl /,$psoutput[$i]);
if ($psline[1] =~ /AST_manager_li/) {$running_listen++;}
if ($psline[1] =~ /AST_manager_li/) {$running_listen++;}
$i++;
}
$i++;
}
if (!$running_listen)
{
@@ -871,7 +960,7 @@ while($one_day_interval > 0)
$bad_grabber_counter=0;
$stat_count++;
}
@@ -960,6 +1049,7 @@ if ($Phour < 10) {$Phour = "0$Phour";}
if ($Pmin < 10) {$Pmin = "0$Pmin";}
if ($Psec < 10) {$Psec = "0$Psec";}
$PDtsSQLdate = "$Pyear$Pmon$Pmday$Phour$Pmin$Psec";
$halfminSQLdate = "$Pyear-$Pmon-$Pmday $Phour:$Pmin:$Psec";
$XDtarget = ($secX - 120);
($Xsec,$Xmin,$Xhour,$Xmday,$Xmon,$Xyear,$Xwday,$Xyday,$Xisdst) = localtime($XDtarget);
+3 -1
View File
@@ -753,7 +753,9 @@ drops_fivemin INT(9) UNSIGNED default '0',
drops_fivemin_pct VARCHAR(6) default '0',
calls_onemin INT(9) UNSIGNED default '0',
drops_onemin INT(9) UNSIGNED default '0',
drops_onemin_pct VARCHAR(6) default '0'
drops_onemin_pct VARCHAR(6) default '0',
differential_onemin VARCHAR(20) default '0',
agents_average_onemin VARCHAR(20) default '0'
);
CREATE TABLE vicidial_dnc (
+3
View File
@@ -23,3 +23,6 @@ ALTER TABLE vicidial_campaigns ADD available_only_ratio_tally ENUM('Y','N') defa
ALTER TABLE vicidial_campaigns ADD adaptive_dropped_percentage SMALLINT(3) default '3';
ALTER TABLE vicidial_campaigns ADD adaptive_maximum_level VARCHAR(6) default '3.0';
ALTER TABLE vicidial_campaigns ADD adaptive_latest_target_gmt VARCHAR(6) default '-7';
ALTER TABLE vicidial_campaign_stats ADD differential_onemin VARCHAR(20) default '0';
ALTER TABLE vicidial_campaign_stats ADD agents_average_onemin VARCHAR(20) default '0';
+18 -2
View File
@@ -180,10 +180,11 @@ echo "\n\n";
if (!$group) {echo "<BR><BR>please select a campaign from the pulldown above</FORM>\n"; exit;}
else
{
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$HOPlev = $row[8];
$DIALmethod = $row[9];
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $row[0]&nbsp; &nbsp; </TD>";
@@ -197,13 +198,21 @@ $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$VDhop = $row[0];
$stmt="select dialable_leads,calls_today,drops_today,drops_today_pct from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
$stmt="select dialable_leads,calls_today,drops_today,drops_today_pct,differential_onemin,agents_average_onemin from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$DAleads = $row[0];
$callsTODAY = $row[1];
$dropsTODAY = $row[2];
$drpctTODAY = $row[3];
$diffONEMIN = $row[4];
$agentsONEMIN = $row[5];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
$diffpctONEMIN = ( ($diffONEMIN / $agentsONEMIN) * 100);
$diffpctONEMIN = sprintf("%01.2f", $diffpctONEMIN);
}
else {$diffpctONEMIN = '0.00';}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>HOPPER LEVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $HOPlev &nbsp; &nbsp; </TD>";
@@ -216,6 +225,13 @@ echo "<TD ALIGN=RIGHT><font size=2><B>CALLS TODAY:</B></TD><TD ALIGN=LEFT><font
echo "<TD ALIGN=RIGHT><font size=2><B>CALLS DROPPED:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $dropsTODAY &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DROPPED PERCENT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $drpctTODAY% &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=CENTER COLSPAN=2><font size=2> &nbsp; $NOW_TIME </TD>";
echo "</TR>";
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL METHOD:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALmethod &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DL DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG AGENTS:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $agentsONEMIN &nbsp; &nbsp; </TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIFF:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $diffpctONEMIN% &nbsp; &nbsp; </TD>";
echo "</TR></TABLE>";