aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/ResponsePriority.pm
blob: af605afa63ce0c43564119b404b696e72055aeb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package FixMyStreet::DB::ResultSet::ResponsePriority;
use base 'DBIx::Class::ResultSet';

use strict;
use warnings;
use Moo;

with('FixMyStreet::Roles::ContactExtra');

sub join_table {
    return 'contact_response_priorities';
}

sub map_extras {
    my ($rs, $params, @ts) = @_;
    my $current = $params->{problem} && $params->{problem}->response_priority_id || 0;
    return
        map { { id => $_->id, name => $_->name } }
        grep { !$_->deleted || $_->id == $current }
        @ts;
}

1;