[Bps-public-commit] r11670 - RT-Extension-Reports/lib/RT/Extension/Reports
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Apr 10 02:10:13 EDT 2008
Author: sunnavy
Date: Thu Apr 10 02:10:12 2008
New Revision: 11670
Modified:
RT-Extension-Reports/lib/RT/Extension/Reports/Util.pm
Log:
added initialize_data sub
Modified: RT-Extension-Reports/lib/RT/Extension/Reports/Util.pm
==============================================================================
--- RT-Extension-Reports/lib/RT/Extension/Reports/Util.pm (original)
+++ RT-Extension-Reports/lib/RT/Extension/Reports/Util.pm Thu Apr 10 02:10:12 2008
@@ -2,16 +2,40 @@
use strict;
use warnings;
+my %session = %HTML::Mason::Commands::session;
-my @OPEN_STATUSES = qw/new open stalled/;
+=head2 initialize_data
-sub is_open {
- my $ticket = shift;
- return unless $ticket;
- return 1 if grep { $ticket->Status eq $_ } @OPEN_STATUSES;
- return 0;
-}
+for initialize collected internal data.
+after initialization, we have:
+$data->{Date}{QueueName}{Key} = 0
+
+=cut
+sub initialize_data {
+ my %args = @_;
+ my $start_date = $args{StartDate};
+ my $end_date = $args{EndDate};
+ my $data = $args{Data};
+ my $keys = $args{Keys};
+
+ my $queues = RT::Queues->new( $session{CurrentUser} );
+ $queues->UnLimit;
+ my @queue_names;
+ while ( my $queue = $queues->Next ) {
+ push @queue_names, $queue->Name;
+ }
+ my $tmp_date = RT::Date->new( $session{CurrentUser} );
+ $tmp_date->Set( Value => $start_date->Unix );
+ while ( $tmp_date->Unix < $end_date->Unix ) {
+ for my $queue (@queue_names) {
+ for (@$keys) {
+ $data->{ $tmp_date->Date }{$queue}{$_} = 0;
+ }
+ }
+ $tmp_date->AddDay;
+ }
+}
1;
@@ -65,5 +89,3 @@
=cut
-
-
More information about the Bps-public-commit
mailing list