From: Ivan Kohler Date: Sun, 10 Aug 2014 16:43:29 +0000 (-0700) Subject: some more status info for CDR processing X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=840bcad433cff431da71fbb001092d2605d09f13 some more status info for CDR processing --- diff --git a/httemplate/view/Status.html b/httemplate/view/Status.html index 019470eb9..6b1cc6de2 100644 --- a/httemplate/view/Status.html +++ b/httemplate/view/Status.html @@ -106,13 +106,47 @@ if ( _is_running('cdrd') ) { $s. 's'; } - $status{'CDR Processing'} = [ { 'title' => 'Current processing delay', 'value' => $delay, }, ]; + my $pr_delay = FS::Record->scalar_sql(' + SELECT AVG(end_date-start_date) + FROM queue_stat + GROUP BY statnum + ORDER BY statnum DESC + LIMIT 100 + '); + if ( $pr_delay ) { + my $h = int($delay/3600); + my $m = int( ($delay%3600) / 60 ); + my $s = $delay%60; + + $pr_delay = ( $h ? $h. 'h' : '' ). + ( $h||$m ? $m. 'm' : ''). + $s. 's'; + + } + $status{'CDR Processing'} = [ + { 'title' => 'Average billing time', + 'value' => $pr_delay, + }, + ]; + + my $24ago = time2str('%Y-%m-$d %X', time - 86400); + my $cdrs = FS::Record->scalar_sql(qq{ + SELECT COUNT(*) FROM cdr + WHERE ( freesidestatus IS NULL OR freesidestatus = '' ) + AND calldate > '$24ago' + }); + $status{'CDR Processing'} = [ + { 'title' => 'Unprocessed CDRs', + 'value' => $cdrs, + }, + ]; + } sub _is_running {