diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-29 15:15:10 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-08-29 15:15:10 +0100 |
commit | 759b5ef970546c0a70fb4f8d051b1f6dd54e4d2d (patch) | |
tree | 2f76a073e1c07df40e8cec71cafef02f5d54c184 /perllib/FixMyStreet/DB/Result/Problem.pm | |
parent | 05c6a4b980b07a7c15b6b9727f6315d326e233a0 (diff) | |
parent | b43dbace0f747897640920e4cf9adb55b84bc2c8 (diff) |
Merge branch 'move-report-states-to-database-part-1'
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 52 |
1 files changed, 4 insertions, 48 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 0d1b396a9..a74a04828 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -323,75 +323,31 @@ my $hidden_states = { 'unconfirmed' => 1, }; -my $visible_states = { - map { - $hidden_states->{$_} ? () : ($_ => 1) - } all_states() -}; - ## e.g.: - # 'confirmed' => 1, - # 'investigating' => 1, - # 'in progress' => 1, - # 'planned' => 1, - # 'action scheduled' => 1, - # 'fixed' => 1, - # 'fixed - council' => 1, - # 'fixed - user' => 1, - # 'unable to fix' => 1, - # 'not responsible' => 1, - # 'duplicate' => 1, - # 'closed' => 1, - # 'internal referral' => 1, - sub hidden_states { return wantarray ? keys %{$hidden_states} : $hidden_states; } sub visible_states { - return wantarray ? keys %{$visible_states} : $visible_states; + my %visible_states = map { + $hidden_states->{$_} ? () : ($_ => 1) + } all_states(); + return wantarray ? keys %visible_states : \%visible_states; } sub visible_states_add { my ($self, @states) = @_; for my $state (@states) { delete $hidden_states->{$state}; - $visible_states->{$state} = 1; } } sub visible_states_remove { my ($self, @states) = @_; for my $state (@states) { - delete $visible_states->{$state}; $hidden_states->{$state} = 1; } } -=head2 - - @states = FixMyStreet::DB::Problem::council_states(); - -Get a list of states that are availble to council users. If called in -array context then returns an array of names, otherwise returns a -HASHREF. - -=cut -sub council_states { - my $states = { - 'confirmed' => 1, - 'investigating' => 1, - 'action scheduled' => 1, - 'in progress' => 1, - 'fixed - council' => 1, - 'unable to fix' => 1, - 'not responsible' => 1, - 'duplicate' => 1, - 'internal referral' => 1, - }; - - return wantarray ? keys %{$states} : $states; -} - my $stz = sub { my ( $orig, $self ) = ( shift, shift ); my $s = $self->$orig(@_); |