diff options
author | Marius Halden <marius.h@lden.org> | 2017-11-03 16:13:59 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2017-11-03 16:13:59 +0100 |
commit | 42d874db498d0fabae92d0c87acf99054d92391b (patch) | |
tree | d0cf5afdee3d244c4e5da6fe1ab9acba620634df /perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm | |
parent | 19a7c5dda85a47a68040c742791e9cd9d3e52be6 (diff) | |
parent | dc7613329c275cd158fdde8faf1c0e301f5b7202 (diff) |
Merge tag 'v2.2' into fiksgatami-dev
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm b/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm index aa9c426f4..89bb4dfd7 100644 --- a/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm +++ b/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm @@ -3,20 +3,18 @@ use base 'DBIx::Class::ResultSet'; use strict; use warnings; +use Moo; +use HTML::Entities; -sub for_bodies { - my ($rs, $bodies, $category) = @_; - my $attrs = { - 'me.body_id' => $bodies, - }; - if ($category) { - $attrs->{'contact.category'} = [ $category, undef ]; - } - $rs->search($attrs, { - order_by => 'name', - join => { 'contact_response_priorities' => 'contact' }, - distinct => 1, - }); +with('FixMyStreet::Roles::ContactExtra'); + +sub join_table { + return 'contact_response_priorities'; +} + +sub map_extras { + my ($rs, @ts) = @_; + return map { { id => $_->id, name => encode_entities($_->name) } } @ts; } 1; |