Skip to content
Browse files

fix dates for test database creation.

  • Loading branch information...
1 parent cc8a219 commit 594ca4854aeb1fbc779b9dc9472997fb82fba11e @barbie committed Jan 28, 2012
Showing with 8 additions and 2 deletions.
  1. +2 −1 Changes
  2. +6 −1 t/05setup_db-cpanstats.t
View
3 Changes
@@ -1,7 +1,8 @@
Revision history for CPAN-Testers-WWW-Statistics
0.96 current
- - set_max & set_range reworked (Graph.pm)
+ - set_max & set_range reworked (Graph.pm).
+ - fix dates for test database creation.
0.95 26/01/2012
- removed NNTP code from cpanmail.cgi.
View
7 t/05setup_db-cpanstats.t
@@ -32,16 +32,21 @@ $dbh->do(q{
)
});
+# calculate dates
my @date = localtime(time);
my $THISMONTH = sprintf "%04d%02d", $date[5]+1900, $date[4]+1;
my $LASTMONTH = sprintf "%04d%02d", $date[4] ? ($date[5]+1900, $date[4]) : ($date[5]+1899, 12);
while(<DATA>){
next unless(/^\d/);
chomp;
+
+ # adjust dates to current months
my @fields = split(/\|/,$_);
$fields[3] =~ s/201101/$LASTMONTH/;
- $fields[11] =~ s/201101/$THISMONTH/;
+ $fields[3] =~ s/201102/$THISMONTH/;
+ $fields[11] =~ s/201101/$LASTMONTH/;
+ $fields[11] =~ s/201102/$THISMONTH/;
$dbh->do('INSERT INTO cpanstats ( id, guid, state, postdate, tester, dist, version, platform, perl, osname, osvers, fulldate, type) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )', {}, @fields );
}

0 comments on commit 594ca48

Please sign in to comment.
Something went wrong with that request. Please try again.