diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index ce7488703..4b738b66c 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -1,3 +1,4 @@ +use utf8; package FixMyStreet::DB::Result::Problem; # Created by DBIx::Class::Schema::Loader @@ -7,7 +8,6 @@ use strict; use warnings; use base 'DBIx::Class::Core'; - __PACKAGE__->load_components("FilterColumn", "InflateColumn::DateTime", "EncodedColumn"); __PACKAGE__->table("problem"); __PACKAGE__->add_columns( @@ -84,6 +84,12 @@ __PACKAGE__->add_columns( { data_type => "boolean", default_value => \"false", is_nullable => 0 }, "geocode", { data_type => "bytea", is_nullable => 1 }, + "send_fail_count", + { data_type => "integer", is_nullable => 1 }, + "send_fail_reason", + { data_type => "text", is_nullable => 1 }, + "send_fail_timestamp", + { data_type => "timestamp", is_nullable => 1 }, ); __PACKAGE__->set_primary_key("id"); __PACKAGE__->has_many( @@ -92,22 +98,22 @@ __PACKAGE__->has_many( { "foreign.problem_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); -__PACKAGE__->belongs_to( - "user", - "FixMyStreet::DB::Result::User", - { id => "user_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, -); __PACKAGE__->has_many( "questionnaires", "FixMyStreet::DB::Result::Questionnaire", { "foreign.problem_id" => "self.id" }, { cascade_copy => 0, cascade_delete => 0 }, ); +__PACKAGE__->belongs_to( + "user", + "FixMyStreet::DB::Result::User", + { id => "user_id" }, + { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, +); -# Created by DBIx::Class::Schema::Loader v0.07010 @ 2011-09-19 14:38:43 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nq8Ufn/SEoDGSrrGlHIxag +# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-03-16 10:08:56 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:VODeZlWk8l/+IzBBlRNV0A # Add fake relationship to stored procedure table __PACKAGE__->has_one( @@ -563,6 +569,35 @@ sub body { } # TODO Some/much of this could be moved to the template + +# either: +# "sent to council 3 mins later" +# "council ref: XYZ" +# or +# "sent to council 3 mins later, their ref: XYZ" +# +# Note: some silliness with pronouns and the adjacent comma mean this is +# being presented as a single string rather than two +sub processed_summary_string { + my ( $problem, $c ) = @_; + my ($duration_clause, $external_ref_clause); + if ($problem->whensent) { + $duration_clause = $problem->duration_string($c) + } + if ($problem->external_id) { + if ($duration_clause) { + $external_ref_clause = sprintf(_('their ref: %s'), $problem->external_id); + } else { + $external_ref_clause = sprintf(_('%s ref: %s'), $problem->external_body, $problem->external_id); + } + } + if ($duration_clause and $external_ref_clause) { + return "$duration_clause, $external_ref_clause" + } else { + return $duration_clause || $external_ref_clause + } +} + sub duration_string { my ( $problem, $c ) = @_; my $body = $problem->body( $c ); |