diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-03-06 15:40:16 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2018-03-07 13:13:38 +0000 |
commit | 1511fd51adef54ec93759ef256ca9f3ce3646adb (patch) | |
tree | 114e66d02011c85734157a8ab134217ec54ee8bf /bin | |
parent | 11edb2b5d154ece38506e853c95f1cb2df67c0e2 (diff) |
[Zurich] Switch to more modern database states.
The Zurich code was written a long time ago, and used overriding so that
e.g. the hard-coded 'investigating' state referred to Wunsch (wish). Now
that states are stored in the database, we can create ones specially for
Zurich and use them instead. Hooray!
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/zurich/fixture | 9 | ||||
-rwxr-xr-x | bin/zurich/overdue-alert | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/bin/zurich/fixture b/bin/zurich/fixture index fec9977a5..e387c4fab 100755 --- a/bin/zurich/fixture +++ b/bin/zurich/fixture @@ -17,6 +17,7 @@ BEGIN { } use FixMyStreet; +use FixMyStreet::Cobrand::Zurich; use FixMyStreet::DB::Factories; use Getopt::Long::Descriptive; @@ -30,6 +31,9 @@ print($usage->text), exit if $opt->help; FixMyStreet::DB::Factories->setup($opt); +my $cobrand = FixMyStreet::Cobrand::Zurich->new(); +$cobrand->db_state_migration; + # Body + categories my $body = FixMyStreet::DB::Factory::Body->find_or_create({ name => 'Zürich', @@ -93,11 +97,10 @@ foreach ( my $lat = 47.381416; my $lon = 8.531369; -my $cobrand = 'zurich'; my $user = $users{'user@example.org'}; my $num = 20; -say "Created $num problems around '$lat,$lon' in cobrand '$cobrand'"; +say "Created $num problems around '$lat,$lon' in cobrand '" . $cobrand->moniker . "'"; my $confirmed = DateTime->today->subtract(days => 1)->add(hours => 8); my $problems = []; for (1..$num) { @@ -110,7 +113,7 @@ for (1..$num) { latitude => $lat, longitude => $lon, category => $category, - cobrand => $cobrand, + cobrand => $cobrand->moniker, confirmed => $confirmed, }); } diff --git a/bin/zurich/overdue-alert b/bin/zurich/overdue-alert index f4fd0f4b7..7689c172f 100755 --- a/bin/zurich/overdue-alert +++ b/bin/zurich/overdue-alert @@ -32,9 +32,9 @@ exit if FixMyStreet::Cobrand::Zurich::is_public_holiday($now) or FixMyStreet::Co my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('zurich')->new(); my %bodies = map { $_->id => $_ } FixMyStreet::DB->resultset("Body")->all; -loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'unconfirmed' ] ); +loop_through( 'alert-moderation-overdue.txt', 0, 1, [ 'submitted' ] ); loop_through( 'alert-overdue.txt', 1, 6, 'in progress' ); -loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'planned'] ); +loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'feedback pending'] ); sub loop_through { my ( $template, $include_parent, $days, $states ) = @_; |