aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-09-05 10:04:48 +0100
committerStruan Donald <struan@exo.org.uk>2012-09-05 10:04:48 +0100
commit174560660da697408db51d2cea617f27558f1b30 (patch)
tree6e305dcf38543314536f5317f62f2d3d7e8478a9
parent8e1336875a074adb7f906651233931e0ea4c22b7 (diff)
handle re-opening of problems via open311 service requests updates correctly
also small tweaks to display of update meta information
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm1
-rw-r--r--t/app/controller/report_updates.t5
-rw-r--r--t/open311/getservicerequestupdates.t4
-rw-r--r--templates/web/default/report/updates.html9
4 files changed, 13 insertions, 6 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index c30d05b22..15a75155a 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -101,6 +101,7 @@ sub update_comments {
$comment->problem_state( 'fixed - council' );
} elsif ( ( $p->is_closed || $p->is_fixed ) and lc($request->{status}) eq 'open' ) {
$p->state( 'confirmed' );
+ $comment->mark_open(1);
$comment->problem_state( 'confirmed' );
}
}
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index cf6af16cb..c4c50f4d1 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -577,7 +577,10 @@ for my $test (
is $update->problem_state, $test->{state}, 'problem state set';
my $update_meta = $mech->extract_update_metas;
- like $update_meta->[0], qr/marked as $test->{fields}->{state}$/, 'update meta includes state change';
+ # setting it to confirmed shouldn't say anything
+ if ( $test->{fields}->{state} ne 'confirmed' ) {
+ like $update_meta->[0], qr/marked as $test->{fields}->{state}$/, 'update meta includes state change';
+ }
like $update_meta->[0], qr{Test User \(Westminster City Council\)}, 'update meta includes council name';
$mech->content_contains( 'Test User (<strong>Westminster City Council</strong>)', 'council name in bold');
diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t
index 7ec8d5ae0..e08d2b1e2 100644
--- a/t/open311/getservicerequestupdates.t
+++ b/t/open311/getservicerequestupdates.t
@@ -136,7 +136,7 @@ for my $test (
start_state => 'fixed - user',
close_comment => 0,
mark_fixed => 0,
- mark_open => 0,
+ mark_open => 1,
problem_state => 'confirmed',
end_state => 'confirmed',
},
@@ -148,7 +148,7 @@ for my $test (
start_state => 'closed',
close_comment => 0,
mark_fixed => 0,
- mark_open => 0,
+ mark_open => 1,
problem_state => 'confirmed',
end_state => 'confirmed',
},
diff --git a/templates/web/default/report/updates.html b/templates/web/default/report/updates.html
index de873e2ed..2f935285a 100644
--- a/templates/web/default/report/updates.html
+++ b/templates/web/default/report/updates.html
@@ -22,8 +22,11 @@
[%- ELSE %]
[% tprintf( loc( 'Posted by %s at %s' ), update.name, prettify_epoch( update.confirmed_local.epoch ) ) | html -%]
[%- END -%]
- [%- ", " _ loc( 'marked as fixed' ) IF update.mark_fixed %]
- [%- ", " _ loc( 'reopened' ) IF update.mark_open %]
- [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state %]
+ [%- IF update.mark_fixed %]
+ [%- ", " _ loc( 'marked as fixed' ) %]
+ [%- ELSE %]
+ [%- ", " _ loc( 'reopened' ) IF update.mark_open %]
+ [%- ", " _ tprintf(loc( 'marked as %s' ), update.meta_problem_state) IF update.problem_state AND update.problem_state != 'confirmed' %]
+ [%- END %]
[% END %]