Skip to content

Commit

Permalink
[UK] Show state in banner for in progress states.
Browse files Browse the repository at this point in the history
This matches the base template and is clearer,
given "In progress" is an actual state.
  • Loading branch information
dracos committed Dec 20, 2023
1 parent 0f97072 commit f8241c5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 36 deletions.
52 changes: 18 additions & 34 deletions t/app/controller/report_display.t
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ foreach my $meta (
};
}

my $old_date = DateTime->new( year => 2009, month => 6, day => 12, hour => 9, minute => 43, second => 12 );

for my $test (
{
description => 'new report',
Expand All @@ -209,14 +211,7 @@ for my $test (
},
{
description => 'old report',
date => DateTime->new(
year => 2009,
month => 6,
day => 12,
hour => 9,
minute => 43,
second => 12
),
date => $old_date,
state => 'confirmed',
banner_id => 'unknown',
banner_text => 'unknown',
Expand All @@ -225,46 +220,35 @@ for my $test (
{
cobrand => 'fixmystreet',
description => 'old open311 report',
date => DateTime->new(
year => 2009,
month => 6,
day => 12,
hour => 9,
minute => 43,
second => 12
),
date => $old_date,
state => 'confirmed',
send_method => 'Open311',
banner_id => undef,
banner_text => undef,
fixed => 0
},
{
cobrand => 'fixmystreet',
description => 'scheduled report',
date => $old_date,
state => 'action scheduled',
send_method => 'Open311',
banner_id => 'progress',
banner_text => 'Action scheduled',
fixed => 0
},
{
cobrand => 'westminster',
description => 'old westminster report',
date => DateTime->new(
year => 2009,
month => 6,
day => 12,
hour => 9,
minute => 43,
second => 12
),
date => $old_date,
state => 'confirmed',
banner_id => undef,
banner_text => undef,
fixed => 0
},
{
description => 'old fixed report',
date => DateTime->new(
year => 2009,
month => 6,
day => 12,
hour => 9,
minute => 43,
second => 12
),
date => $old_date,
state => 'fixed',
banner_id => 'fixed',
banner_text => 'fixed',
Expand Down Expand Up @@ -389,13 +373,13 @@ for my $test (
}

if ( $test->{banner_id} ) {
ok $banner->{class} =~ /banner--$test->{banner_id}/i, 'banner class';
like $banner->{class}, qr/banner--$test->{banner_id}/i, 'banner class';
} else {
is $banner->{class}, $test->{banner_id}, 'banner class';
}

if ($test->{banner_text}) {
ok $banner->{text} =~ /$test->{banner_text}/i, 'banner text';
like $banner->{text}, qr/$test->{banner_text}/i, 'banner text';
} else {
is $banner->{text}, $test->{banner_text}, 'banner text';
}
Expand Down
2 changes: 1 addition & 1 deletion templates/web/fixmystreet-uk-councils/report/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
[% END %]

[% IF problem.is_in_progress %]
[% INCLUDE banner, id = 'progress', text = loc('In progress') %]
[% INCLUDE banner, id = 'progress', text = prettify_state(problem.state) %]
[% END %]
2 changes: 1 addition & 1 deletion templates/web/fixmystreet.com/report/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[% IF problem.send_method_used != 'Open311' AND problem.is_open AND date.now - problem.lastupdate.epoch > 8 * 7 * 24 * 60 * 60 %]
[% INCLUDE banner, id = 'unknown', text = loc('Status unknown') %]
[% ELSIF problem.is_in_progress %]
[% INCLUDE banner, id = 'progress', text = loc('In progress') %]
[% INCLUDE banner, id = 'progress', text = prettify_state(problem.state) %]
[% END %]

[% END %]

0 comments on commit f8241c5

Please sign in to comment.