aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm31
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.