[freeside-commits] freeside/FS/FS svc_port.pm,1.2,1.3
Ivan,,,
ivan at wavetail.420.am
Sun Jan 30 14:02:23 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv19760
Modified Files:
svc_port.pm
Log Message:
what's going on with bw graphs, RT#10574
Index: svc_port.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_port.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- svc_port.pm 29 Jan 2011 02:50:27 -0000 1.2
+++ svc_port.pm 30 Jan 2011 22:02:21 -0000 1.3
@@ -3,14 +3,14 @@
use strict;
use vars qw($conf $system $DEBUG $me );
use base qw( FS::svc_Common );
-use FS::Record qw( qsearch qsearchs dbh );
+use FS::Record qw( qsearch qsearchs dbh str2time_sql str2time_sql_closing );
use FS::cust_svc;
use GD::Graph;
use GD::Graph::mixed;
use Date::Format qw(time2str);
use Data::Dumper;
-$DEBUG = 0;
+$DEBUG = 1;
$me = '[FS::svc_port]';
FS::UID->install_callback( sub {
@@ -218,7 +218,7 @@
my $suffix = '';
- warn "$me _format_bandwidth $value" if $DEBUG;
+ warn "$me _format_bandwidth $value" if $DEBUG > 1;
if ( $value >= 1000 && $value < 1000000 ) {
$value = ($value/1000);
@@ -255,7 +255,10 @@
|| $end <= $start || $end < 0 || $end > $now || $start > $now
|| $end-$start > 86400*366 );
+ local($FS::Record::nowarn_classload) = 1;
+
my $serviceid_sql = "('${serviceid}_IN','${serviceid}_OUT')";
+
my @records;
my $dbh = dbh;
if ( $dbh->{Driver}->{Name} eq 'Pg' ) {
@@ -280,6 +283,21 @@
return 'Unsupported DBMS';
}
+ #my $_date = str2time_sql. "srv_date||' '||srv_time".
+ # str2time_sql_closing;
+
+ #my @records = qsearch({
+ # 'table' => 'srvexport',
+ # 'select' => "*, $_date as _date",
+ # 'extra_sql' => "where serviceid in $serviceid_sql
+ # and $_date >= $start
+ # and $_date <= $end",
+ # 'order_by' => "order by $_date asc",
+ #});
+
+ warn "$me ". scalar(@records). " records returned for $serviceid\n"
+ if $DEBUG;
+
# assume data in DB is correct,
# assume always _IN and _OUT pair, assume intvl = 300
@@ -334,7 +352,7 @@
. "out_max=$out_max in_avg=$in_avg out_avg=$out_avg "
. " # records = " . scalar(@records) . "\n\ntimes:\n"
. Dumper(@times) . "\n\nin:\n" . Dumper(@in) . "\n\nout:\n"
- . Dumper(@out) if $DEBUG;
+ . Dumper(@out) if $DEBUG > 1;
my @data = ( \@times, \@in, \@out );
More information about the freeside-commits
mailing list