diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-02-14 16:15:32 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-02-14 16:36:17 +0000 |
commit | 5c88c6954449bb6d2dbc1a6d1142d08adbc89d55 (patch) | |
tree | 8403f80f6d80cb60541ae90a0fe6e1b4ea8d324e | |
parent | f8fef5162bddb4e10f22f8ddce8314a585ec8b4b (diff) |
Remove *_local tz functions, set timezone on fetching original columns from database.
37 files changed, 133 insertions, 153 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 125293666..bb7ec2381 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -145,34 +145,34 @@ sub timeline : Path( 'timeline' ) : Args(0) { my $probs = $c->cobrand->problems->timeline; foreach ($probs->all) { - push @{$time{$_->created->epoch}}, { type => 'problemCreated', date => $_->created_local, obj => $_ }; - push @{$time{$_->confirmed->epoch}}, { type => 'problemConfirmed', date => $_->confirmed_local, obj => $_ } if $_->confirmed; - push @{$time{$_->whensent->epoch}}, { type => 'problemSent', date => $_->whensent_local, obj => $_ } if $_->whensent; + push @{$time{$_->created->epoch}}, { type => 'problemCreated', date => $_->created, obj => $_ }; + push @{$time{$_->confirmed->epoch}}, { type => 'problemConfirmed', date => $_->confirmed, obj => $_ } if $_->confirmed; + push @{$time{$_->whensent->epoch}}, { type => 'problemSent', date => $_->whensent, obj => $_ } if $_->whensent; } my $questionnaires = $c->model('DB::Questionnaire')->timeline( $c->cobrand->restriction ); foreach ($questionnaires->all) { - push @{$time{$_->whensent->epoch}}, { type => 'quesSent', date => $_->whensent_local, obj => $_ }; - push @{$time{$_->whenanswered->epoch}}, { type => 'quesAnswered', date => $_->whenanswered_local, obj => $_ } if $_->whenanswered; + push @{$time{$_->whensent->epoch}}, { type => 'quesSent', date => $_->whensent, obj => $_ }; + push @{$time{$_->whenanswered->epoch}}, { type => 'quesAnswered', date => $_->whenanswered, obj => $_ } if $_->whenanswered; } my $updates = $c->model('DB::Comment')->timeline( $site_restriction ); foreach ($updates->all) { - push @{$time{$_->created->epoch}}, { type => 'update', date => $_->created_local, obj => $_} ; + push @{$time{$_->created->epoch}}, { type => 'update', date => $_->created, obj => $_} ; } my $alerts = $c->model('DB::Alert')->timeline_created( $c->cobrand->restriction ); foreach ($alerts->all) { - push @{$time{$_->whensubscribed->epoch}}, { type => 'alertSub', date => $_->whensubscribed_local, obj => $_ }; + push @{$time{$_->whensubscribed->epoch}}, { type => 'alertSub', date => $_->whensubscribed, obj => $_ }; } $alerts = $c->model('DB::Alert')->timeline_disabled( $c->cobrand->restriction ); foreach ($alerts->all) { - push @{$time{$_->whendisabled->epoch}}, { type => 'alertDel', date => $_->whendisabled_local, obj => $_ }; + push @{$time{$_->whendisabled->epoch}}, { type => 'alertDel', date => $_->whendisabled, obj => $_ }; } $c->model('DB')->schema->storage->sql_maker->quote_char( '' ); diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index 7b8cb649f..a4e72e9bd 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -240,8 +240,8 @@ sub output_requests : Private { 'long' => [ $problem->longitude ], 'status' => [ $problem->state ], # 'status_notes' => [ {} ], - 'requested_datetime' => [ w3date($problem->confirmed_local) ], - 'updated_datetime' => [ w3date($problem->lastupdate_local) ], + 'requested_datetime' => [ w3date($problem->confirmed) ], + 'updated_datetime' => [ w3date($problem->lastupdate) ], # 'expected_datetime' => [ {} ], # 'address' => [ {} ], # 'address_id' => [ {} ], @@ -260,7 +260,7 @@ sub output_requests : Private { if ( $problem->whensent ) { # Not in Open311 v2 $request->{'agency_sent_datetime'} = - [ w3date($problem->whensent_local) ]; + [ w3date($problem->whensent) ]; } # Extract number of updates diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 374578713..257d9ec24 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -708,7 +708,7 @@ Returns the colour of pin to be used for a particular report =cut sub pin_colour { my ( $self, $p, $context ) = @_; - #return 'green' if time() - $p->confirmed_local->epoch < 7 * 24 * 60 * 60; + #return 'green' if time() - $p->confirmed->epoch < 7 * 24 * 60 * 60; return 'yellow' if $context eq 'around' || $context eq 'reports'; return $p->is_fixed ? 'green' : 'red'; } diff --git a/perllib/FixMyStreet/DB/Result/Alert.pm b/perllib/FixMyStreet/DB/Result/Alert.pm index ca9ad45c2..fc84c8fd5 100644 --- a/perllib/FixMyStreet/DB/Result/Alert.pm +++ b/perllib/FixMyStreet/DB/Result/Alert.pm @@ -77,22 +77,21 @@ with 'FixMyStreet::Roles::Abuser'; my $tz = DateTime::TimeZone->new( name => "local" ); - -sub whensubscribed_local { - my $self = shift; - - return $self->whensubscribed - ? $self->whensubscribed->set_time_zone($tz) - : $self->whensubscribed; -} - -sub whendisabled_local { - my $self = shift; - - return $self->whendisabled - ? $self->whendisabled->set_time_zone($tz) - : $self->whendisabled; -} +my $tz_f; +$tz_f = DateTime::TimeZone->new( name => FixMyStreet->config('TIME_ZONE') ) + if FixMyStreet->config('TIME_ZONE'); + +my $stz = sub { + my ( $orig, $self ) = ( shift, shift ); + my $s = $self->$orig(@_); + return $s unless $s && UNIVERSAL::isa($s, "DateTime"); + $s->set_time_zone($tz); + $s->set_time_zone($tz_f) if $tz_f; + return $s; +}; + +around whensubscribed => $stz; +around whendisabled => $stz; =head2 confirm diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index 33fbb9356..eb9e52a65 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -116,23 +116,21 @@ with 'FixMyStreet::Roles::Abuser'; my $tz = DateTime::TimeZone->new( name => "local" ); -sub created_local { - my $self = shift; - - return $self->created - ? $self->created->set_time_zone($tz) - : $self->created; -} - -sub confirmed_local { - my $self = shift; - - # if confirmed is null then it doesn't get inflated so don't - # try and set the timezone - return $self->confirmed - ? $self->confirmed->set_time_zone($tz) - : $self->confirmed; -} +my $tz_f; +$tz_f = DateTime::TimeZone->new( name => FixMyStreet->config('TIME_ZONE') ) + if FixMyStreet->config('TIME_ZONE'); + +my $stz = sub { + my ( $orig, $self ) = ( shift, shift ); + my $s = $self->$orig(@_); + return $s unless $s && UNIVERSAL::isa($s, "DateTime"); + $s->set_time_zone($tz); + $s->set_time_zone($tz_f) if $tz_f; + return $s; +}; + +around created => $stz; +around confirmed => $stz; # You can replace this text with custom code or comments, and it will be preserved on regeneration diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index ad23446fb..693d6dcc9 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -342,37 +342,23 @@ sub council_states { my $tz = DateTime::TimeZone->new( name => "local" ); -sub confirmed_local { - my $self = shift; - - return $self->confirmed - ? $self->confirmed->set_time_zone($tz) - : $self->confirmed; -} - -sub created_local { - my $self = shift; - - return $self->created - ? $self->created->set_time_zone($tz) - : $self->created; -} - -sub whensent_local { - my $self = shift; +my $tz_f; +$tz_f = DateTime::TimeZone->new( name => FixMyStreet->config('TIME_ZONE') ) + if FixMyStreet->config('TIME_ZONE'); - return $self->whensent - ? $self->whensent->set_time_zone($tz) - : $self->whensent; -} - -sub lastupdate_local { - my $self = shift; +my $stz = sub { + my ( $orig, $self ) = ( shift, shift ); + my $s = $self->$orig(@_); + return $s unless $s && UNIVERSAL::isa($s, "DateTime"); + $s->set_time_zone($tz); + $s->set_time_zone($tz_f) if $tz_f; + return $s; +}; - return $self->lastupdate - ? $self->lastupdate->set_time_zone($tz) - : $self->lastupdate; -} +around created => $stz; +around confirmed => $stz; +around whensent => $stz; +around lastupdate => $stz; around service => sub { my ( $orig, $self ) = ( shift, shift ); @@ -574,7 +560,7 @@ meta data about the report. sub meta_line { my ( $problem, $c ) = @_; - my $date_time = Utils::prettify_dt( $problem->confirmed_local ); + my $date_time = Utils::prettify_dt( $problem->confirmed ); my $meta = ''; # FIXME Should be in cobrand @@ -709,7 +695,7 @@ sub duration_string { my ( $problem, $c ) = @_; my $body = $problem->body( $c ); return sprintf(_('Sent to %s %s later'), $body, - Utils::prettify_duration($problem->whensent_local->epoch - $problem->confirmed_local->epoch, 'minute') + Utils::prettify_duration($problem->whensent->epoch - $problem->confirmed->epoch, 'minute') ); } @@ -832,8 +818,8 @@ sub as_hashref { is_fixed => $self->fixed_states->{ $self->state } ? 1 : 0, photo => $self->get_photo_params, meta => $self->confirmed ? $self->meta_line( $c ) : '', - confirmed_pp => $self->confirmed ? $c->cobrand->prettify_dt( $self->confirmed_local ): '', - created_pp => $c->cobrand->prettify_dt( $self->created_local ), + confirmed_pp => $self->confirmed ? $c->cobrand->prettify_dt( $self->confirmed ): '', + created_pp => $c->cobrand->prettify_dt( $self->created ), }; } diff --git a/perllib/FixMyStreet/DB/Result/Questionnaire.pm b/perllib/FixMyStreet/DB/Result/Questionnaire.pm index b6791603a..fcaa17d99 100644 --- a/perllib/FixMyStreet/DB/Result/Questionnaire.pm +++ b/perllib/FixMyStreet/DB/Result/Questionnaire.pm @@ -44,23 +44,25 @@ __PACKAGE__->belongs_to( # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NGlSRjoBpDoIvK3EueqN6Q use DateTime::TimeZone; +use Moose; +use namespace::clean -except => [ 'meta' ]; my $tz = DateTime::TimeZone->new( name => "local" ); -sub whensent_local { - my $self = shift; +my $tz_f; +$tz_f = DateTime::TimeZone->new( name => FixMyStreet->config('TIME_ZONE') ) + if FixMyStreet->config('TIME_ZONE'); - return $self->whensent - ? $self->whensent->set_time_zone($tz) - : $self->whensent; -} +my $stz = sub { + my ( $orig, $self ) = ( shift, shift ); + my $s = $self->$orig(@_); + return $s unless $s && UNIVERSAL::isa($s, "DateTime"); + $s->set_time_zone($tz); + $s->set_time_zone($tz_f) if $tz_f; + return $s; +}; -sub whenanswered_local { - my $self = shift; - - return $self->whenanswered - ? $self->whenanswered->set_time_zone($tz) - : $self->whenanswered; -} +around whensent => $stz; +around whenanswered => $stz; 1; diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index 61f59f725..b92aa8cfd 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -57,7 +57,7 @@ sub send { push @$extra, { name => 'report_title', value => $row->title }; push @$extra, { name => 'public_anonymity_required', value => $row->anonymous ? 'TRUE' : 'FALSE' }; push @$extra, { name => 'email_alerts_requested', value => 'FALSE' }; # always false as can never request them - push @$extra, { name => 'requested_datetime', value => DateTime::Format::W3CDTF->format_datetime($row->confirmed_local->set_nanosecond(0)) }; + push @$extra, { name => 'requested_datetime', value => DateTime::Format::W3CDTF->format_datetime($row->confirmed->set_nanosecond(0)) }; push @$extra, { name => 'email', value => $row->user->email }; $row->extra( $extra ); diff --git a/perllib/Open311.pm b/perllib/Open311.pm index efa0ac64f..3be5ac365 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -322,7 +322,7 @@ sub _populate_service_request_update_params { } my $params = { - updated_datetime => DateTime::Format::W3CDTF->format_datetime($comment->confirmed_local->set_nanosecond(0)), + updated_datetime => DateTime::Format::W3CDTF->format_datetime($comment->confirmed->set_nanosecond(0)), service_request_id => $comment->problem->external_id, status => $status, email => $comment->user->email, diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index aae0940c7..ae1f06a50 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -120,7 +120,7 @@ sub update_comments { # if the comment is older than the last update # do not change the status of the problem as it's # tricky to determine the right thing to do. - if ( $comment->created_local > $p->lastupdate_local ) { + if ( $comment->created > $p->lastupdate ) { my $state = $self->map_state( $request->{status} ); # don't update state unless it's an allowed state and it's diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 04d973067..27d604a59 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -226,12 +226,7 @@ sub prettify_dt { $type ||= ''; $type = 'short' if $type eq '1'; - $dt->set_time_zone( FixMyStreet->config('TIME_ZONE') ) - if FixMyStreet->config('TIME_ZONE'); - - my $now = DateTime->now( time_zone => 'local' ); - $now->set_time_zone( FixMyStreet->config('TIME_ZONE') ) - if FixMyStreet->config('TIME_ZONE'); + my $now = DateTime->now( time_zone => FixMyStreet->config('TIME_ZONE') || 'local' ); my $tt = ''; $tt = $dt->strftime('%H:%M') unless $type eq 'date'; diff --git a/t/app/model/comment.t b/t/app/model/comment.t index 93104c2e5..3141af828 100644 --- a/t/app/model/comment.t +++ b/t/app/model/comment.t @@ -23,5 +23,5 @@ my $comment = $comment_rs->new( } ); -is $comment->confirmed_local, undef, 'inflating null confirmed ok'; -is $comment->created_local, undef, 'inflating null confirmed ok'; +is $comment->confirmed, undef, 'inflating null confirmed ok'; +is $comment->created, undef, 'inflating null confirmed ok'; diff --git a/t/app/model/problem.t b/t/app/model/problem.t index a92e3b079..6ba2bbde4 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -32,10 +32,10 @@ my $problem = $problem_rs->new( } ); -is $problem->confirmed_local, undef, 'inflating null confirmed ok'; -is $problem->whensent_local, undef, 'inflating null confirmed ok'; -is $problem->lastupdate_local, undef, 'inflating null confirmed ok'; -is $problem->created_local, undef, 'inflating null confirmed ok'; +is $problem->confirmed, undef, 'inflating null confirmed ok'; +is $problem->whensent, undef, 'inflating null confirmed ok'; +is $problem->lastupdate, undef, 'inflating null confirmed ok'; +is $problem->created, undef, 'inflating null confirmed ok'; for my $test ( { diff --git a/templates/web/default/admin/list_updates.html b/templates/web/default/admin/list_updates.html index 22f9aaf83..681337844 100644 --- a/templates/web/default/admin/list_updates.html +++ b/templates/web/default/admin/list_updates.html @@ -27,7 +27,7 @@ <td>[% update.state %]</td> <td>[% update.name | html %]</td> <td>[% update.user.email | html %]</td> - <td>[% PROCESS format_time time=update.created_local %]</td> + <td>[% PROCESS format_time time=update.created %]</td> <td>[% IF update.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF update.user.belongs_to_body( update.problem.bodies_str ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> diff --git a/templates/web/default/admin/problem_row.html b/templates/web/default/admin/problem_row.html index f3ab65397..1533f8dd2 100644 --- a/templates/web/default/admin/problem_row.html +++ b/templates/web/default/admin/problem_row.html @@ -20,14 +20,14 @@ <td>[% PROCESS value_or_nbsp value=problem.category %]</td> <td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% problem.cobrand %]<br>[% problem.cobrand_data | html %]</td> - <td>[% PROCESS format_time time=problem.created_local %]</td> + <td>[% PROCESS format_time time=problem.created %]</td> <td>[% problem.state %]<small> - [%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %] [% PROCESS format_time time=problem.confirmed_local %][% END -%] - [%- IF problem.is_fixed %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate_local %][% END -%] - [%- IF problem.is_closed %]<br>[% loc('Closed:') %] [% PROCESS format_time time=problem.lastupdate_local %][% END -%] - [%- IF problem.is_open %]<br>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate_local %][% END -%]</small> + [%- IF problem.is_visible %]<br>[% loc('Confirmed:' ) %] [% PROCESS format_time time=problem.confirmed %][% END -%] + [%- IF problem.is_fixed %]<br>[% loc('Fixed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%] + [%- IF problem.is_closed %]<br>[% loc('Closed:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%] + [%- IF problem.is_open %]<br>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %][% END -%]</small> </td> - <td>[% PROCESS format_time time=problem.whensent_local %]</td> + <td>[% PROCESS format_time time=problem.whensent %]</td> <td><a href="[% c.uri_for( 'report_edit', problem.id ) %]">[% loc('Edit') %]</a></td> </tr> [%- END -%] diff --git a/templates/web/default/admin/report_edit.html b/templates/web/default/admin/report_edit.html index 18993a87c..b76d1717a 100644 --- a/templates/web/default/admin/report_edit.html +++ b/templates/web/default/admin/report_edit.html @@ -38,10 +38,10 @@ <li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% problem.name | html %]'></li> <li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% problem.user.email | html %]'> [% PROCESS abuse_button %] [% PROCESS flag_button user=problem.user %]</li> <li>[% loc('Phone:') %] [% problem.user.phone | html %]</li> -<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created_local %]</li> -<li>[% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed_local no_time='-' %]</li> -<li>[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent_local %] [% IF problem.state == 'confirmed' %]<input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">[% END %]</li> -<li>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate_local %]</li> +<li>[% loc('Created:') %] [% PROCESS format_time time=problem.created %]</li> +<li>[% loc('Confirmed:') %] [% PROCESS format_time time=problem.confirmed no_time='-' %]</li> +<li>[% loc('Sent:') %] [% PROCESS format_time time=problem.whensent %] [% IF problem.state == 'confirmed' %]<input onclick="return confirm('[% loc('You really want to resend?') %]')" type="submit" name="resend" value="[% loc('Resend report') %]">[% END %]</li> +<li>[% loc('Last update:') %] [% PROCESS format_time time=problem.lastupdate %]</li> <li>[% loc('Service:') %] [% problem.service %]</li> <li>[% loc('Cobrand:') %] [% problem.cobrand %]</li> <li>[% loc('Cobrand data:') %] [% problem.cobrand_data %]</li> diff --git a/templates/web/default/admin/timeline.html b/templates/web/default/admin/timeline.html index 4058f7f06..2c77e3fbd 100644 --- a/templates/web/default/admin/timeline.html +++ b/templates/web/default/admin/timeline.html @@ -34,7 +34,7 @@ [% CASE 'alertSub' %] [% tprintf(loc("Alert %d created for %s, type %s, parameters %s / %s"), item.obj.id, item.obj.user.email, item.obj.alert_type.ref, item.obj.parameter, item.obj.parameter2) | html %] [% CASE 'alertDel' %] - [% tprintf(loc("Alert %d disabled (created %s)"), item.obj.id, item.obj.whensubscribed_local.strftime('%H:%M:%S %e %B %Y') ) %] + [% tprintf(loc("Alert %d disabled (created %s)"), item.obj.id, item.obj.whensubscribed.strftime('%H:%M:%S %e %B %Y') ) %] [%- END %] <br /> [%- END %] diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html index dde81641b..26d262f73 100644 --- a/templates/web/default/admin/update_edit.html +++ b/templates/web/default/admin/update_edit.html @@ -42,7 +42,7 @@ [% PROCESS abuse_button %] [% PROCESS flag_button user=update.user %]</li> <li>[% loc('Cobrand:') %] [% update.cobrand %]</li> <li>[% loc('Cobrand data:') %] [% update.cobrand_data %]</li> -<li>[% loc('Created:') %] [% PROCESS format_time time=update.created_local %]</li> +<li>[% loc('Created:') %] [% PROCESS format_time time=update.created %]</li> [% IF update.photo %] [% photo = update.get_photo_params %] diff --git a/templates/web/default/around/around_map_list_items.html b/templates/web/default/around/around_map_list_items.html index 655d8bd25..da75561b5 100644 --- a/templates/web/default/around/around_map_list_items.html +++ b/templates/web/default/around/around_map_list_items.html @@ -5,7 +5,7 @@ <li> <a href="[% c.uri_for('/report', p.problem.id ) %]">[% p.problem.title | html %]</a> - <small>[% prettify_dt( p.problem.confirmed_local, 1 ) %], [% dist %]km</small> + <small>[% prettify_dt( p.problem.confirmed, 1 ) %], [% dist %]km</small> [% IF p.problem.is_fixed %] <small>[% loc('(fixed)') %]</small> [% ELSIF p.problem.is_closed %] diff --git a/templates/web/default/around/on_map_list_items.html b/templates/web/default/around/on_map_list_items.html index 1022c88a0..70a071406 100644 --- a/templates/web/default/around/on_map_list_items.html +++ b/templates/web/default/around/on_map_list_items.html @@ -2,7 +2,7 @@ [% FOREACH p IN on_map %] <li> <a href="[% c.uri_for('/report', p.id ) %]">[% p.title | html %]</a> - <small>[% prettify_dt( p.confirmed_local, 1 ) %]</small> + <small>[% prettify_dt( p.confirmed, 1 ) %]</small> [% IF p.is_fixed %] <small>[% loc('(fixed)') %]</small> [% ELSIF p.is_closed %] diff --git a/templates/web/default/contact/index.html b/templates/web/default/contact/index.html index cb87362ba..3997198bb 100644 --- a/templates/web/default/contact/index.html +++ b/templates/web/default/contact/index.html @@ -18,9 +18,9 @@ <blockquote> <p> [% IF update.anonymous %] - [% tprintf( loc('Update below added anonymously at %s'), prettify_dt( update.confirmed_local ) ) %] + [% tprintf( loc('Update below added anonymously at %s'), prettify_dt( update.confirmed ) ) %] [% ELSE %] - [% tprintf( loc('Update below added by %s at %s'), update.name, prettify_dt( update.confirmed_local ) ) | html %] + [% tprintf( loc('Update below added by %s at %s'), update.name, prettify_dt( update.confirmed ) ) | html %] [% END %] </p> @@ -42,9 +42,9 @@ <p> [% IF problem.anonymous %] - [% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed_local ) ) %] + [% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed ) ) %] [% ELSE %] - [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed_local ) ) | html %] + [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed ) ) | html %] [% END %] </p> diff --git a/templates/web/default/index.html b/templates/web/default/index.html index 9dc6f54b2..6ae9db3e8 100644 --- a/templates/web/default/index.html +++ b/templates/web/default/index.html @@ -55,7 +55,7 @@ [% FOREACH p IN probs %] <li> <a href="/report/[% p.id %]">[% p.title | html %]</a> - <small>[% prettify_dt( p.confirmed_local, 1 ) %]</small> + <small>[% prettify_dt( p.confirmed, 1 ) %]</small> </li> [% END %] </ul> diff --git a/templates/web/default/my/my.html b/templates/web/default/my/my.html index cb9b0dd99..a6e4000df 100644 --- a/templates/web/default/my/my.html +++ b/templates/web/default/my/my.html @@ -53,7 +53,7 @@ END %] <li>“[% u.text | html %]” – <a href="[% c.uri_for( '/report', u.problem_id ) %]#update_[% u.id %]">[% u.problem.title | html %]</a>. <em class="council_sent_info"> - [% tprintf( loc("Added %s"), prettify_dt( u.confirmed_local, 'date' ) ) %] + [% tprintf( loc("Added %s"), prettify_dt( u.confirmed, 'date' ) ) %] </em> </li> [% "</ul>" IF loop.last %] @@ -69,9 +69,9 @@ END %] <li><a href="[% c.uri_for( '/report', p.id ) %]">[% p.title | html %]</a> <em class="council_sent_info"> – [% IF p.whensent %] - [% tprintf( loc("Reported %s, to %s"), prettify_dt( p.confirmed_local, 'date' ), p.body(c) ) %] + [% tprintf( loc("Reported %s, to %s"), prettify_dt( p.confirmed, 'date' ), p.body(c) ) %] [% ELSE %] - [% tprintf( loc("Reported %s"), prettify_dt( p.confirmed_local, 'date' ) ) %] + [% tprintf( loc("Reported %s"), prettify_dt( p.confirmed, 'date' ) ) %] [% END %] </em> </li> diff --git a/templates/web/default/report/banner.html b/templates/web/default/report/banner.html index 52bfa6e67..bd7798d79 100644 --- a/templates/web/default/report/banner.html +++ b/templates/web/default/report/banner.html @@ -5,7 +5,7 @@ </p> [% END %] -[% IF problem.is_open AND date.now - problem.lastupdate_local.epoch > 8 * 7 * 24 * 60 * 60 %] +[% IF problem.is_open AND date.now - problem.lastupdate.epoch > 8 * 7 * 24 * 60 * 60 %] [% INCLUDE banner, id = 'unknown', text = loc('This problem is old and of unknown status.') %] [% END %] [% IF problem.is_fixed %] diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html index 04a8bec33..f56ded735 100644 --- a/templates/web/default/report/updates.html +++ b/templates/web/default/report/updates.html @@ -7,21 +7,21 @@ [% IF update.whenanswered %] [%# A questionnaire update, currently saying report is still open %] - [% tprintf( loc( 'Still open, via questionnaire, %s' ), prettify_dt( update.whenanswered_local ) ) %] + [% tprintf( loc( 'Still open, via questionnaire, %s' ), prettify_dt( update.whenanswered ) ) %] [% RETURN %] [% END %] [% IF update.anonymous || update.name == '' %] - [% tprintf( loc( 'Posted anonymously at %s' ), prettify_dt( update.confirmed_local ) ) -%] + [% tprintf( loc( 'Posted anonymously at %s' ), prettify_dt( update.confirmed ) ) -%] [%- ELSIF update.user.from_body; user_name = update.user.name | html; body = update.user.body; IF body == 'Bromley Council'; body = "$body <img src='/cobrands/bromley/favicon.png' alt=''>"; END %] - [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, body, prettify_dt( update.confirmed_local ) ) -%] + [% tprintf( loc( 'Posted by %s (<strong>%s</strong>) at %s' ), user_name, body, prettify_dt( update.confirmed ) ) -%] [%- ELSE %] - [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_dt( update.confirmed_local ) ) | html -%] + [% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_dt( update.confirmed ) ) | html -%] [%- END -%] [%- update_state = '' %] [%- IF update.mark_fixed %][% update_state = ", " _ loc( 'marked as fixed' ) %][% END %] diff --git a/templates/web/fixmystreet/contact/index.html b/templates/web/fixmystreet/contact/index.html index 450b6e2ef..174fd1d7e 100644 --- a/templates/web/fixmystreet/contact/index.html +++ b/templates/web/fixmystreet/contact/index.html @@ -19,9 +19,9 @@ <blockquote> <p> [% IF update.anonymous %] - [% tprintf( loc('Update below added anonymously at %s'), prettify_dt( update.confirmed_local ) ) %] + [% tprintf( loc('Update below added anonymously at %s'), prettify_dt( update.confirmed ) ) %] [% ELSE %] - [% tprintf( loc('Update below added by %s at %s'), update.name, prettify_dt( update.confirmed_local ) ) | html %] + [% tprintf( loc('Update below added by %s at %s'), update.name, prettify_dt( update.confirmed ) ) | html %] [% END %] </p> @@ -43,9 +43,9 @@ <p> [% IF problem.anonymous %] - [% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed_local ) ) %] + [% tprintf( loc('Reported anonymously at %s'), prettify_dt( problem.confirmed ) ) %] [% ELSE %] - [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed_local ) ) | html %] + [% tprintf( loc('Reported by %s at %s'), problem.user.name, prettify_dt( problem.confirmed ) ) | html %] [% END %] </p> diff --git a/templates/web/fixmystreet/my/my.html b/templates/web/fixmystreet/my/my.html index 3134c335f..12f68bd80 100644 --- a/templates/web/fixmystreet/my/my.html +++ b/templates/web/fixmystreet/my/my.html @@ -57,7 +57,7 @@ END %] <li>“[% u.text | html %]” – <a href="[% c.uri_for( '/report', u.problem_id ) %]#update_[% u.id %]">[% u.problem.title | html %]</a>. <p><small class="council_sent_info"> - [% tprintf( loc("Added %s"), prettify_dt( u.confirmed_local, 'date' ) ) %] + [% tprintf( loc("Added %s"), prettify_dt( u.confirmed, 'date' ) ) %] </small></p> </li> [% "</ul>" IF loop.last %] diff --git a/templates/web/fixmystreet/report/_item.html b/templates/web/fixmystreet/report/_item.html index f910d0f8c..36aa5ee16 100644 --- a/templates/web/fixmystreet/report/_item.html +++ b/templates/web/fixmystreet/report/_item.html @@ -6,10 +6,10 @@ <img class="img" height="60" width="90" src="[% photo.url_fp %]" alt=""> [% END %] <h4>[% problem.title | html %]</h4> - <small>[% prettify_dt( problem.confirmed_local, 1 ) %] + <small>[% prettify_dt( problem.confirmed, 1 ) %] [%- IF dist %], [% dist %]km[% END %] [%- IF include_lastupdate AND problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], - [% tprintf('last updated %s', prettify_dt( problem.lastupdate_local, 1 ) ) %] + [% tprintf('last updated %s', prettify_dt( problem.lastupdate, 1 ) ) %] [%- END %] [% IF include_lastupdate %] [% IF problem.bodies_str_ids.size > 1 %] [% loc('(sent to both)') %] diff --git a/templates/web/fixmystreet/report/banner.html b/templates/web/fixmystreet/report/banner.html index 25c9db424..2292352ad 100644 --- a/templates/web/fixmystreet/report/banner.html +++ b/templates/web/fixmystreet/report/banner.html @@ -5,7 +5,7 @@ </div> [% END %] -[% IF c.cobrand.moniker != 'bromley' AND problem.council != '2482' AND problem.is_open AND date.now - problem.lastupdate_local.epoch > 8 * 7 * 24 * 60 * 60 %] +[% IF c.cobrand.moniker != 'bromley' AND problem.council != '2482' AND problem.is_open AND date.now - problem.lastupdate.epoch > 8 * 7 * 24 * 60 * 60 %] [% INCLUDE banner, id = 'unknown', text = loc('Unknown') %] [% END %] [% IF problem.is_fixed %] diff --git a/templates/web/zurich/admin/list_updates.html b/templates/web/zurich/admin/list_updates.html index f486284e3..c475d839e 100644 --- a/templates/web/zurich/admin/list_updates.html +++ b/templates/web/zurich/admin/list_updates.html @@ -10,7 +10,7 @@ [% FOREACH update IN updates -%] <tr[% ' class="adminhidden"' IF update.state == 'hidden' || update.problem.state == 'hidden' %]> <td>[%- update.id %]</td> - <td>[% PROCESS format_date this_date=update.created_local %] [% update.created_local.hms %]</td> + <td>[% PROCESS format_date this_date=update.created %] [% update.created.hms %]</td> <td>[% update.text | html %]</td> </tr> [% END -%] diff --git a/templates/web/zurich/admin/problem_row.html b/templates/web/zurich/admin/problem_row.html index 7974915eb..f84d22711 100644 --- a/templates/web/zurich/admin/problem_row.html +++ b/templates/web/zurich/admin/problem_row.html @@ -18,8 +18,8 @@ </td> <td>[% PROCESS value_or_nbsp value=problem.title %]</td> <td>[% PROCESS value_or_nbsp value=problem.category %]</td> - <td>[% PROCESS format_date this_date=problem.created_local %]</td> - <td>[% PROCESS format_date this_date=problem.lastupdate_local %]</td> + <td>[% PROCESS format_date this_date=problem.created %]</td> + <td>[% PROCESS format_date this_date=problem.lastupdate %]</td> <td>[% states.${problem.state} %]</td> [% IF include_subdiv %] diff --git a/templates/web/zurich/admin/report_edit-sdm.html b/templates/web/zurich/admin/report_edit-sdm.html index 54a78ace4..39d74881c 100644 --- a/templates/web/zurich/admin/report_edit-sdm.html +++ b/templates/web/zurich/admin/report_edit-sdm.html @@ -41,7 +41,7 @@ <li><span class="mock-label">[% loc('Email:') %]</span> [% problem.user.email | html %] [% IF NOT problem.extra.email_confirmed %]<span class="error">[% loc('Unconfirmed') %]</span>[% END %] <li><span class="mock-label">[% loc('Phone:') %]</span> [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li> -<li><span class="mock-label">[% loc('Created:') %]</span> [% PROCESS format_date this_date=problem.created_local %] [% problem.created_local.hms %]</li> +<li><span class="mock-label">[% loc('Created:') %]</span> [% PROCESS format_date this_date=problem.created %] [% problem.created.hms %]</li> [% IF problem.photo %] [% photo = problem.get_photo_params %] diff --git a/templates/web/zurich/admin/report_edit.html b/templates/web/zurich/admin/report_edit.html index 07586604b..30416f4c0 100644 --- a/templates/web/zurich/admin/report_edit.html +++ b/templates/web/zurich/admin/report_edit.html @@ -55,7 +55,7 @@ [% IF NOT problem.extra.email_confirmed %]<span class="error">[% loc('Unconfirmed') %]</span>[% END %] </li> <li><span class="mock-label">[% loc('Phone:') %]</span> [% IF problem.user.phone %][% problem.user.phone | html %][% ELSE %]<em>[% loc('None') %]</em>[% END %]</li> -<li><span class="mock-label">[% loc('Created:') %]</span> [% PROCESS format_date this_date=problem.created_local %] [% problem.created_local.hms %]</li> +<li><span class="mock-label">[% loc('Created:') %]</span> [% PROCESS format_date this_date=problem.created %] [% problem.created.hms %]</li> [% IF problem.photo %] diff --git a/templates/web/zurich/admin/update_edit.html b/templates/web/zurich/admin/update_edit.html index c2e427941..ab40981a5 100644 --- a/templates/web/zurich/admin/update_edit.html +++ b/templates/web/zurich/admin/update_edit.html @@ -26,7 +26,7 @@ [% END %] </li> -<li>[% loc('Created:') %] [% PROCESS format_date this_date=update.created_local %] [% update.created_local.hms %]</li> +<li>[% loc('Created:') %] [% PROCESS format_date this_date=update.created %] [% update.created.hms %]</li> [% IF update.photo %] [% photo = update.get_photo_params %] diff --git a/templates/web/zurich/report/_item.html b/templates/web/zurich/report/_item.html index ad503fc51..9462b8e2d 100644 --- a/templates/web/zurich/report/_item.html +++ b/templates/web/zurich/report/_item.html @@ -10,10 +10,10 @@ [% ELSE %] <h4><em>[% loc('Awaiting moderation') %]</em></h4> [% END %] - <small>[% prettify_dt( problem.created_local, 'zurich' ) %] + <small>[% prettify_dt( problem.created, 'zurich' ) %] [%- IF dist %], [% dist %]km[% END %] - [%- IF include_lastupdate AND problem.created_local != problem.lastupdate_local AND problem.whensent_local != problem.lastupdate_local %], - [% tprintf('last updated %s', prettify_dt( problem.lastupdate_local, 'zurich' ) ) %] + [%- IF include_lastupdate AND problem.created != problem.lastupdate AND problem.whensent != problem.lastupdate %], + [% tprintf('last updated %s', prettify_dt( problem.lastupdate, 'zurich' ) ) %] [%- END %] [% IF NOT no_fixed AND problem.is_fixed %] [% loc('(fixed)') %] diff --git a/templates/web/zurich/report/_main.html b/templates/web/zurich/report/_main.html index e6c310873..c5fbabf1c 100644 --- a/templates/web/zurich/report/_main.html +++ b/templates/web/zurich/report/_main.html @@ -1,7 +1,7 @@ <div class="problem-header cf"> <h1>[% tprintf( loc('Reported in the %s category'), problem.category ) %]</h1> <p class="sub"> - [% prettify_dt( problem.created_local, 'zurich' ) %] + [% prettify_dt( problem.created, 'zurich' ) %] [%- IF !problem.used_map %]<br>[% loc('there is no pin shown as the user did not use the map') %][% END %] </p> diff --git a/templates/web/zurich/report/updates.html b/templates/web/zurich/report/updates.html index 69c8af99f..786ecd582 100644 --- a/templates/web/zurich/report/updates.html +++ b/templates/web/zurich/report/updates.html @@ -4,7 +4,7 @@ <li> <div class="update-wrap"> <div class="update-text"> - <p class="meta-2">[% prettify_dt( problem.lastupdate_local, 'zurich' ) %]</p> + <p class="meta-2">[% prettify_dt( problem.lastupdate, 'zurich' ) %]</p> [% IF problem.state == 'fixed - council' %] [% add_links( problem.extra.public_response ) | html_para %] [% ELSIF problem.state == 'closed' AND problem.external_body %] |