Mercurial > pub > buggler
diff lib/Benzin/Bugzilla/Bug.pm @ 10:14a966369278
working version of exporting bugs from bugzilla in tj3 format (without bookings)
author | cin |
---|---|
date | Mon, 07 Sep 2015 01:37:11 +0300 |
parents | cc7244ab1b9f |
children | 4eb9fdf4efa9 |
line wrap: on
line diff
--- a/lib/Benzin/Bugzilla/Bug.pm Sat Sep 05 22:01:12 2015 +0300 +++ b/lib/Benzin/Bugzilla/Bug.pm Mon Sep 07 01:37:11 2015 +0300 @@ -46,22 +46,10 @@ use constant { BUG_FIELDS => \@fields }; use IMPL::declare { - require => { - Strptime => 'DateTime::Format::Strptime' - }, - base => [ - 'IMPL::Object::Fields' => undef - ] + base => [ 'IMPL::Object::Fields' => undef ] }; - use fields @fields; -my $dtparser = Strptime->new( - pattern => '%Y%m%dT%H:%M:%S', - time_zone => 'UTC', - on_error => 'croak' -); - sub CTOR { my SELF $this = shift; my $data = shift; @@ -71,7 +59,7 @@ # returns { # reports => [ -# { who => email:string, when => report-date-time:DateTime, work_time => hours:double } +# { who => email:string, start => work-start-date-time:DateTime, end => report-date-time:DateTime, work_time => hours:double } # ], # actual => hours # remaining => hours @@ -79,16 +67,13 @@ sub GetTimeReports { my SELF $this = shift; my $resolution = shift || 0.25; - - warn "Processing: $this->{id}"; my @bookings; my $actual = 0; for my $history ( @{ $this->{history} || [] } ) { - my $who = $history->{who}; - warn $history->{when}; - my $when = $dtparser->parse_datetime( $history->{when} ); + my $who = $history->{who}; + my $when = $history->{when}; my $changes = $history->{changes}; for my $change ( @{ $changes || [] } ) { @@ -101,10 +86,11 @@ if ($dt) { push @bookings, { - who => $who, + end => $who, when => $when->iso8601(), work_time => $dt, - start => $when->clone()->subtract( hours => $dt )->iso8601() + start => $when->clone()->subtract( hours => $dt ) + ->iso8601() }; $actual += $dt; } @@ -125,4 +111,4 @@ return $resolution ? ceil( $value / $resolution ) * $resolution : $value; } -1; \ No newline at end of file +1;