aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm37
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm2
2 files changed, 38 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 366024c7c..47dac1e8e 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -284,6 +284,43 @@ sub get_photo_params {
return $photo;
}
+=head2 is_open
+
+Returns 1 if the problem is in a open state otherwise 0;
+
+=cut
+
+sub is_open {
+ my $self = shift;
+
+ my %open_states = (
+ unconfirmed => 1,
+ partial => 1,
+ confirmed => 1,
+ 'planned' => 1,
+ 'investigating' => 1,
+ 'in progress' => 1,
+ );
+
+ return exists $open_states{ $self->state } ? 1 : 0;
+}
+
+=head2
+
+ @states = FixMyStreet::DB::Problem::visible_states();
+
+Returns a list of states that should be displayed on the site.
+
+=cut
+
+sub visible_states {
+ return (
+ 'confirmed', 'planned', 'investigating',
+ 'in progress', 'fixed', 'fixed - council',
+ 'fixed - user', 'will not fix',
+ );
+}
+
=head2 meta_line
Returns a string to be used on a problem report page, describing some of the
diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
index e490c77a6..665e0e3e0 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
@@ -19,7 +19,7 @@ sub send_questionnaires_period {
# Select all problems that need a questionnaire email sending
my $q_params = {
- state => [ 'confirmed', 'fixed' ],
+ state => [ FixMyStreet::DB::Result::Problem::visible_states() ],
whensent => [
'-and',
{ '!=', undef },