diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-22 18:06:49 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-22 18:06:49 +0100 |
commit | e907816b20bea99f7640f4ebb5e4ef1058fe0904 (patch) | |
tree | 121999e651a9630e831ffa669f90786b610be8c8 /perllib/FixMyStreet/DB/Result/Problem.pm | |
parent | 100be5b30fb9720b6078440f929e44cc1230dcba (diff) |
is_closed utility method
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index c607cc89b..fa3772310 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -162,6 +162,25 @@ sub fixed_states { =head2 + @states = FixMyStreet::DB::Problem::closed_states(); + +Get a list or states that should be regarded as closed. If called in +array context then returns an array of names, otherwise returns a +HASHREF. + +=cut + +sub closed_states { + my $states = { + 'closed' => 1, + }; + + return wantarray ? keys %{$states} : $states; +} + + +=head2 + @states = FixMyStreet::DB::Problem::visible_states(); Get a list or states that should be visible on the site. If called in @@ -376,6 +395,18 @@ sub is_fixed { return exists $self->fixed_states->{ $self->state } ? 1 : 0; } +=head2 is_closed + +Returns 1 if the problem is in a closed state otherwise 0. + +=cut + +sub is_closed { + my $self = shift; + + return exists $self->closed_states->{ $self->state } ? 1 : 0; +} + =head2 is_visible Returns 1 if the problem should be displayed on the site otherwise 0. |