[Rt-commit] r5532 - in Test-Chimps/branches/dbi: . bin examples lib/Test/Chimps

zev at bestpractical.com zev at bestpractical.com
Wed Jul 5 18:23:01 EDT 2006


Author: zev
Date: Wed Jul  5 18:23:01 2006
New Revision: 5532

Added:
   Test-Chimps/branches/dbi/lib/Test/Chimps/ReportCollection.pm
Modified:
   Test-Chimps/branches/dbi/   (props changed)
   Test-Chimps/branches/dbi/bin/report_server.pl
   Test-Chimps/branches/dbi/examples/list.tmpl
   Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm
   Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
   Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
   Test-Chimps/branches/dbi/lib/Test/Chimps/Server/Lister.pm

Log:
 r9866 at galvatron:  zev | 2006-07-05 16:53:33 -0400
 forgot to push changes before I blew away my local branch


Modified: Test-Chimps/branches/dbi/bin/report_server.pl
==============================================================================
--- Test-Chimps/branches/dbi/bin/report_server.pl	(original)
+++ Test-Chimps/branches/dbi/bin/report_server.pl	Wed Jul  5 18:23:01 2006
@@ -1,11 +1,11 @@
 #!/usr/bin/env perl
 
-use lib '/home/zev/bps/Test-Chimps/branches/categories-rework/lib';
+use lib '/home/zev/bps/Test-Chimps/branches/dbi/lib';
 
 use Test::Chimps::Server;
 
 my $server = Test::Chimps::Server->new(base_dir => '/var/www/bps-smokes',
-                                       list_template => 'list2.tmpl',
+                                       list_template => 'list.tmpl',
                                        variables_validation_spec =>
                                        { project => 1,
                                          revision => 1,

Modified: Test-Chimps/branches/dbi/examples/list.tmpl
==============================================================================
--- Test-Chimps/branches/dbi/examples/list.tmpl	(original)
+++ Test-Chimps/branches/dbi/examples/list.tmpl	Wed Jul  5 18:23:01 2006
@@ -77,37 +77,34 @@
 % foreach my $subcategory (sort keys %{$categories->{$category}}) {
         <tr><th colspan="11" class="subcategory"><% $subcategory %></th></tr>
 % foreach my $report (@{$categories->{$category}->{$subcategory}}) {
-% my $id = $report->{id};
-% my $data = $report->report_variables;
-% my $model = Test::TAP::Model::Visual->new_with_struct($report->model_structure);
           <tr>
-            <td class="report_summary"><% $data->{project} %></td>
+            <td class="report_summary"><% $report->project %></td>
             <td>
-              r<% $data->{revision} %>
+              r<% $report->revision %>
             </td>
-            <td class="leftsep"><% $data->{author} %></td>
-            <td class="leftsep"><% $data->{timestamp} %></td>
-            <td class="leftsep num"><% $data->{duration} %>&nbsp;sec</td>
-            <td class="leftsep num"><% sprintf("%.2f", $model->total_ratio * 100) %>%&nbsp;ok</td>
-	    <td class="leftsep num tests_total"><span title="<% $model->total_seen %> total"><% $model->total_seen %></span>:</td>
-	    <td class="num tests_ok"><span title="<% $model->total_ok %> ok"><% $model->total_ok %></span>,</td>
-	    <td class="num tests_failed"><span title="<% $model->total_failed %> failed"><% $model->total_failed %></span>,</td>
-	    <td class="num tests_todo"><span title="<% $model->total_todo %> todo"><% $model->total_todo %></span>,</td>
-	    <td class="num tests_skipped"><span title="<% $model->total_skipped %> skipped"><% $model->total_skipped %></span>,</td>
-	    <td class="num tests_unexpect"><span title="<% $model->total_unexpectedly_succeeded %> unexpectedly succeeded"><% $model->total_unexpectedly_succeeded %></span></td>
-	    <td><span title="Details" class="expander" onclick="toggle_visibility('<% $id %>')" id="expander_<% $id %>">&raquo;</span></td>
-	    <td><a style="text-decoration: none" href="<% $report->{url} %>" title="Full smoke report">&raquo;</a></td>
+            <td class="leftsep"><% $report->committer %></td>
+            <td class="leftsep"><% $report->timestamp %></td>
+            <td class="leftsep num"><% $report->duration %>&nbsp;sec</td>
+            <td class="leftsep num"><% sprintf("%.2f", $report->total_ratio * 100) %>%&nbsp;ok</td>
+	    <td class="leftsep num tests_total"><span title="<% $report->total_seen %> total"><% $report->total_seen %></span>:</td>
+	    <td class="num tests_ok"><span title="<% $report->total_ok %> ok"><% $report->total_ok %></span>,</td>
+	    <td class="num tests_failed"><span title="<% $report->total_failed %> failed"><% $report->total_failed %></span>,</td>
+	    <td class="num tests_todo"><span title="<% $report->total_todo %> todo"><% $report->total_todo %></span>,</td>
+	    <td class="num tests_skipped"><span title="<% $report->total_skipped %> skipped"><% $report->total_skipped %></span>,</td>
+	    <td class="num tests_unexpect"><span title="<% $report->total_unexpectedly_succeeded %> unexpectedly succeeded"><% $report->total_unexpectedly_succeeded %></span></td>
+	    <td><span title="Details" class="expander" onclick="toggle_visibility('<% $report->id %>')" id="expander_<% $report->id %>">&raquo;</span></td>
+	    <td><a style="text-decoration: none" href="<% detail_url($cgi, $report) %>" title="Full smoke report">&raquo;</a></td>
           </tr>
-          <tr class="details" id="details_<% $id %>">
+          <tr class="details" id="details_<% $report->id %>">
             <td colspan="11" class="report_details">
-                <span class="tests_total"><% $model->total_seen %> test cases</span>:<br />
-		<span class="tests_ok"><% $model->total_ok %> ok</span>,
-		<span class="tests_failed"><% $model->total_failed %> failed</span>,
-		<span class="tests_todo"><% $model->total_todo %> todo</span>,<br />
-                <span class="tests_skipped"><% $model->total_skipped %> skipped</span> and
-		<span class="tests_unexpect"><% $model->total_unexpectedly_succeeded %> unexpectedly succeeded</span>
+                <span class="tests_total"><% $report->total_seen %> test cases</span>:<br />
+		<span class="tests_ok"><% $report->total_ok %> ok</span>,
+		<span class="tests_failed"><% $report->total_failed %> failed</span>,
+		<span class="tests_todo"><% $report->total_todo %> todo</span>,<br />
+                <span class="tests_skipped"><% $report->total_skipped %> skipped</span> and
+		<span class="tests_unexpect"><% $report->total_unexpectedly_succeeded %> unexpectedly succeeded</span>
               <br />
-              <a href="<% $report->{url} %>" title="Full smoke report">View full smoke report</a>
+              <a href="<% detail_url($cgi, $report) %>" title="Full smoke report">View full smoke report</a>
             </td>
           </tr>
 % }
@@ -119,5 +116,12 @@
 
 <%args>
 $categories
+$cgi
 </%args>
 
+<%once>
+sub detail_url {
+  my ($cgi, $report) = @_;
+  return $cgi->url . "?id=" . $report->id;
+}
+</%once>

Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm	(original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Client.pm	Wed Jul  5 18:23:01 2006
@@ -9,11 +9,11 @@
 use LWP::UserAgent;
 use YAML::Syck;
 
-use constant PROTO_VERSION => 0.1;
+use constant PROTO_VERSION => 0.2;
 
 =head1 NAME
 
-Test::Chimps::Client - Send a Test::Chimps::Report to a server
+Test::Chimps::Client - Send smoke test results to a server
 
 =head1 VERSION
 
@@ -25,10 +25,9 @@
 
 =head1 SYNOPSIS
 
-This module simplifies the process of sending C<Test::Chimps::Report>s to a
-smoke server.
+This module simplifies the process of sending smoke test results
+(in the form of C<Test::TAP::Model>s) to a smoke server.
 
-    use Test::Chimps::Report;
     use Test::Chimps::Client;
     use Test::TAP::Model::Visual;
 
@@ -36,10 +35,10 @@
 
     my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));
 
-    my $report = Test::Chimps::Report->new(model => $model);
-
-    my $client = Test::Chimps::Client->new(reports => [$report],
-                                           server => 'http://www.example.com/cgi-bin/smoke-server.pl');
+    my $client = Test::Chimps::Client->new(
+      server => 'http://www.example.com/cgi-bin/smoke-server.pl',
+      model  => $model
+    );
     
     my ($status, $msg) = $client->send;
     
@@ -61,15 +60,14 @@
 
 Optional.  Does not currently work
 
-=item * reports
+=item * model
 
-Mandatory.  The value must be an array reference which contains
-C<Test::Chimps>s.  These are the reports that will be
-submitted to the server.
+Mandatory.  The value must be a C<Test::TAP::Model>.  These are the
+test results that will be submitted to the server.
 
 =item * server
 
-Mandatory.  The URI of the server script to upload the reports to.
+Mandatory.  The URI of the server script to upload the models to.
 
 =back
 
@@ -77,7 +75,7 @@
 
 use base qw/Class::Accessor/;
 
-__PACKAGE__->mk_ro_accessors(qw/reports server compress/);
+__PACKAGE__->mk_ro_accessors(qw/models server compress report_variables/);
 
 sub new {
   my $class = shift;
@@ -88,29 +86,30 @@
 
 sub _init {
   my $self = shift;
-  validate_with(
+  my %args = validate_with(
     params => \@_,
     called => 'The Test::Chimps::Client constructor',
     spec   => {
-      reports  => { type => ARRAYREF },
-      server   => 1,
-      compress => 0
+      model            => { isa => 'Test::TAP::Model' },
+      server           => 1,
+      compress         => 0,
+      report_variables => {
+        optional => 1,
+        type     => HASHREF,
+        default  => {}
+      }
     }
   );
-  
-  my %args = @_;
-  $self->{reports} = $args{reports};
-  foreach my $report (@{$self->{reports}}) {
-    croak "one the the specified reports is not a Test::Chimps::Report"
-      if ! (ref $report && $report->isa('Test::Chimps::Report'));
+
+  foreach my $key (keys %args) {
+    $self->{$key} = $args{$key};
   }
-  $self->{server} = $args{server};
-  $self->{compress} = $args{compress} || 0;
+
 }
 
 =head2 send
 
-Submit the specified reports to the server.  This function's return
+Submit the specified model to the server.  This function's return
 value is a list, the first of which indicates success or failure,
 and the second of which is an error string.
 
@@ -123,9 +122,9 @@
   $ua->agent("Test-Chimps-Client/" . PROTO_VERSION);
   $ua->env_proxy;
 
-  my $serialized_reports = [ map { Dump($_) } @{$self->reports} ];
   my %request = (upload => 1, version => PROTO_VERSION,
-                 reports => $serialized_reports);
+                 model_structure => Dump($self->model->structure),
+                 report_variables => Dump($self->report_variables));
 
   my $resp = $ua->post($self->server => \%request);
   if($resp->is_success) {
@@ -141,7 +140,8 @@
 
 =head1 ACCESSORS
 
-There are read-only accessors for compress, reports, and server.
+There are read-only accessors for compress, model,
+report_variables, and server.
 
 =head1 AUTHOR
 

Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm	(original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm	Wed Jul  5 18:23:01 2006
@@ -3,123 +3,58 @@
 use warnings;
 use strict;
 
-use Carp;
-use Params::Validate qw/:all/;
-use Test::TAP::HTMLMatrix;
-use YAML::Syck;
-
 =head1 NAME
 
 Test::Chimps::Report - Encapsulate a smoke test report
 
-=head1 VERSION
-
-Version 0.01
-
-=cut
-
-our $VERSION = '0.01';
-
 =head1 SYNOPSIS
 
-This module encapsulates a L<Test::TAP::Model>'s structure and a
-freeform report text.  If not provided, Test::TAP::HTMLMatrix will
-be used to generate the report.
-
-    use Test::Chimps::Report;
-    use Test::TAP::Model::Visual;
-
-    chdir "some/module/directory";
-
-    my $model = Test::TAP::Model::Visual->new_with_tests(glob("t/*.t"));
-
-    my $report = Test::Chimps::Report->new(model => $model);
-
-    ...
+FIXME
 
 =head1 METHODS
 
 =head2 new ARGS
 
-Creates a new Report.  ARGS is a hash whose valid keys are:
+Creates a new Report.  ARGS is a hash whose only valid key is
+handle.  Its value must be a Jifty::DBI::Handle.
+
+=head1 COLUMNS
+
+C<Test::Chimps::Report>s have the following columns (and consequently accessors):
 
 =over 4
 
-=item * model
+=item * report_html
+
+=item * model_structure
 
-Mandatory and must be an instance of C<Test::Tap::Model>.
+=item * total_ok
 
-=item * report_text
+=item * total_failed
 
-A free-form report.  If not supplied, it is filled in using
-C<Test::TAP::HTMLMatrix>, and C<extra_data> will be passed as the
-C<extra> argument to its constructor.  Note that if you are using
-this class in conjunction with C<Test::Chimps::Server>,
-C<report_text> should probably be HTML.
+=item * total_todo
 
-=item * report_variables
+=item * total_skipped
 
-Report variables to be transmitted with the report.  The decision
-of which variables should be submitted is made by the server.
+=item * total_unexpectedly_succeeded
 
 =back
 
 =cut
 
-use base qw/Class::Accessor/;
+use base qw/Jifty::DBI::Record/;
 
-__PACKAGE__->mk_ro_accessors(
-  qw/model_structure
-    report_text report_variables/
-);
-
-
-sub new {
-  my $class = shift;
-  my $obj = bless {}, $class;
-  $obj->_init(@_);
-  return $obj;
-}
-
-sub _init {
-  my $self = shift;
-  validate_with(
-    params => \@_,
-    called => 'The Test::Chimps::Report constructor',
-    spec   => {
-      model            => { isa => 'Test::TAP::Model' },
-      report_text      => 0,
-      report_variables => {
-        optional => 1,
-        type     => HASHREF
-      }
-    }
-  );
-
-  my %args = @_;
-
-  $self->{model_structure} = $args{model}->structure;
-  if (defined $args{report_text}) {
-    $self->{report_text} = $args{report_text};
-  } else {
-    my $v;
-    if (defined $args{report_variables}) {
-      $v = Test::TAP::HTMLMatrix->new($args{model},
-                                      Dump($args{report_variables}));
-      $self->{report_variables} = $args{report_variables};
-    } else {
-      $v = Test::TAP::HTMLMatrix->new($args{model});
-      $self->{report_variables} = '';
-    }
-    $v->has_inline_css(1);
-    $self->{report_text} = $v->detail_html;
-  }
-}
+package Test::Chimps::Report::Schema;
 
-=head1 ACCESSORS
+use Jifty::DBI::Schema;
 
-There are read-only accessors for model_structure, report_text, and
-report_variables.
+column report_html => type is 'text';
+column model_structure => type is 'text';
+column total_ok => type is 'integer';
+column total_failed => type is 'integer';
+column total_todo => type is 'integer';
+column total_skipped => type is 'integer';
+column total_unexpectedly_succeeded => type is 'integer';
 
 =head1 AUTHOR
 

Added: Test-Chimps/branches/dbi/lib/Test/Chimps/ReportCollection.pm
==============================================================================
--- (empty file)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/ReportCollection.pm	Wed Jul  5 18:23:01 2006
@@ -0,0 +1,12 @@
+package Test::Chimps::ReportCollection;
+
+use warnings;
+use strict;
+
+use base qw/Jifty::DBI::Collection/;
+
+sub record_class {
+  return 'Test::Chimps::Report';
+}
+
+1;

Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm	(original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm	Wed Jul  5 18:23:01 2006
@@ -3,6 +3,7 @@
 use warnings;
 use strict;
 
+use Test::Chimps::ReportCollection;
 use Test::Chimps::Report;
 use Test::Chimps::Server::Lister;
 
@@ -13,11 +14,13 @@
 use File::Basename;
 use File::Spec;
 use Fcntl       qw<:DEFAULT :flock>;
+use Jifty::DBI::Handle;
+use Jifty::DBI::SchemaGenerator;
 use Params::Validate qw<:all>;
 use Storable    qw<store_fd fd_retrieve freeze>;
 use YAML::Syck;
 
-use constant PROTO_VERSION => 0.1;
+use constant PROTO_VERSION => 0.2;
 
 =head1 NAME
 
@@ -115,7 +118,7 @@
   qw/base_dir bucket_file max_rate max_size
     max_reports_per_subcategory report_dir
     template_dir list_template lister
-    variables_validation_spec/
+    variables_validation_spec handle/
 );
 
 sub new {
@@ -202,6 +205,33 @@
   foreach my $key (keys %args) {
     $self->{$key} = $args{$key};
   }
+
+  if (defined $self->variables_validation_spec) {
+    foreach my $var (keys %{$self->variables_validation_spec}) {
+      package Test::Chimps::Report::Schema;
+      column($var, type(is('text')));
+    }
+  }
+
+  my $dbname = File::Spec->catfile($self->base_dir, 'database');
+  $self->{handle} = Jifty::DBI::Handle->new();
+
+  # create the table if the db doesn't exist.  ripped out of
+  # Jifty::Script::Schema because this stuff should be in
+  # Jifty::DBI, but isn't
+  if (! -e $dbname) {
+    my $sg = Jifty::DBI::SchemaGenerator->new($self->handle);
+    $sg->add_model(Test::Chimps::Report->new(handle => $self->handle));
+  
+    $self->handle->connect(driver => 'SQLite',
+                           database => $dbname);
+    # for non SQLite
+#    $self->handle->simple_query('CREATE DATABASE database');
+    $self->handle->simple_query($_) for $sg->create_table_sql_statements;
+  } else {
+    $self->handle->connect(driver => 'SQLite',
+                           database => $dbname);
+  }
 }
 
 =head2 handle_request
@@ -280,8 +310,8 @@
     exit;
   }
 
-  if(! $cgi->param("reports")) {
-    print "No reports given!";
+  if(! $cgi->param("model_structure")) {
+    print "No model structure given!";
     exit;
   }
 
@@ -292,21 +322,17 @@
   my $self = shift;
   my $cgi = shift;
   
-  my @reports = map { Load($_) } $cgi->param("reports");
-  
   if (defined $self->{variables_validation_spec}) {
-    foreach my $report (@reports) {
-      eval {
-        validate(@{[%{$report->{report_variables}}]}, $self->{variables_validation_spec});
-      };
-      if (defined $@ && $@) {
-        # XXX: doesn't dump subroutines because we're using YAML::Syck
-        print "This server accepts specific report variables.  It's validation ",
-          "string looks like this:\n", Dump($self->{variables_validation_spec}),
-          "\nYour extra data looks like this:\n", Dump($report->{report_variables});
-        exit;
-      }
-
+    my $report_variables = Load($cgi->param('report_variables'));
+    eval {
+      validate(@{[%$report_variables]}, $self->{variables_validation_spec});
+    };
+    if (defined $@ && $@) {
+      # XXX: doesn't dump subroutines because we're using YAML::Syck
+      print "This server accepts specific report variables.  It's validation ",
+        "string looks like this:\n", Dump($self->{variables_validation_spec}),
+          "\nYour extra data looks like this:\n", $cgi->param('report_variables');
+      exit;
     }
   }
 }
@@ -315,26 +341,26 @@
   my $self = shift;
   my $cgi = shift;
 
-  my @reports = $cgi->param("reports");
+  my $params = {};
+  my $report_variables = Load($cgi->param('report_variables'));
+  foreach my $var (@{$report_variables}) {
+    $params->{$var} = $report_variables->{$var};
+  }
+  
+  my $model = Test::TAP::Model::Visual->new_with_structure($cgi->param('model_structure'));
 
-  foreach my $report (@reports) {
-    my $id = md5_hex $report;
+  foreach my $var (qw/total_ok total_failed total_todo
+                      total_skipped total_unexpectedly_succeeded/) {
+    $params->{$var} = $model->$var;
+  }
 
-    my $report_file = File::Spec->catfile($self->{base_dir},
-                                          $self->{report_dir},
-                                          $id . ".yml");
-    if (-e $report_file) {
-      print  "One of the submitted reports was already submitted!";
-      exit;
-    }
+  $params->{report_html} =
+    Test::TAP::HTMLMatrix->new($model,
+                               $cgi->param('report_variables'));
 
-    open my $fh, ">", $report_file or
-      croak "Couldn't open \"$report_file\" for writing: $!\n";
-    print $fh $report or
-      croak "Couldn't write to \"$report_file\": $!\n";
-    close $fh or
-      croak "Couldn't close \"$report_file\": $!\n";
-  }
+  my $report = Test::Chimps::Report->new(handle => $self->handle);
+
+  $report->create($params) or croak "Couldn't add report to database: $!\n";
 }
 
 sub _process_detail {
@@ -345,16 +371,10 @@
   
   my $id = $cgi->param("id");
 
-  unless ($id =~ m/^[a-f0-9]+$/i) {
-    print "Invalid id: $id";
-    exit;
-  }
-
-  my $report = LoadFile(File::Spec->catfile($self->{base_dir},
-                                            $self->{report_dir},
-                                            $id . ".yml"));
-
-  print $report->report_text;
+  my $report = Test::Chimps::Report->new(handle => $self->handle);
+  $report->load($id);
+  
+  print $report->report_html;
 }
 
 sub _process_listing {
@@ -363,17 +383,11 @@
 
   print $cgi->header();
 
-  my @files = glob File::Spec->catfile($self->{base_dir},
-                                       $self->{report_dir},
-                                       "*.yml");
-
-  my @reports = map { LoadFile($_) } @files;
-
-  # XXX FIXME we shouldn't just be adding this stuff here
-  for (my $i = 0; $i < scalar @reports ; $i++) {
-    my ($filename, $directories, $suffix) = fileparse($files[$i], '.yml');
-    $reports[$i]->{url} = $cgi->url . "?id=$filename";
-    $reports[$i]->{id} = $filename;
+  my $report_coll = Test::Chimps::ReportCollection->new(handle => $self->handle);
+  $report_coll->unlimit;
+  my @reports;
+  while (my $report = $report_coll->next) {
+    push @reports, $report;
   }
 
   my $lister;
@@ -388,7 +402,8 @@
   
   $lister->output_list(File::Spec->catdir($self->{base_dir},
                                           $self->{template_dir}),
-                       \@reports);
+                       \@reports,
+                       $cgi);
                                                    
 }
 

Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Server/Lister.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Server/Lister.pm	(original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Server/Lister.pm	Wed Jul  5 18:23:01 2006
@@ -88,7 +88,7 @@
 }
 
 sub output_list {
-  my ($self, $template_dir, $reports) = @_;
+  my ($self, $template_dir, $reports, $cgi) = @_;
 
   my $interp = HTML::Mason::Interp->new(comp_root => $template_dir);
 
@@ -96,7 +96,8 @@
 
   $interp->exec(File::Spec->catfile(File::Spec->rootdir,
                                     $self->list_template),
-                categories => $categories);
+                categories => $categories,
+                cgi => $cgi);
 }
 
 sub _build_heirarchy {
@@ -117,7 +118,7 @@
 sub _compute_category {
   my $self = shift;
   my $report = shift;
-  return $report->report_variables->{project};
+  return $report->project;
 }
 
 sub _compute_subcategory {
@@ -139,14 +140,14 @@
 }
 
 sub _by_revision_then_date {
-  my $res = $b->report_variables->{revision} <=> $a->report_variables->{revision};
+  my $res = $b->revision <=> $a->revision;
 
   if ($res != 0) {
     return $res;
   }
   
-  my ($adate, $bdate) = (DateTime->from_epoch(epoch => str2time($a->report_variables->{timestamp})),
-                         DateTime->from_epoch(epoch => str2time($b->report_variables->{timestamp})));
+  my ($adate, $bdate) = (DateTime->from_epoch(epoch => str2time($a->timestamp)),
+                         DateTime->from_epoch(epoch => str2time($b->timestamp)));
   return DateTime->compare($bdate, $adate);
 }
 


More information about the Rt-commit mailing list