Further work on import functions

This commit is contained in:
Tom Bloor 2017-11-13 13:30:33 +00:00
parent 593efcedfa
commit 9096bef00d
9 changed files with 382 additions and 0 deletions

View file

@ -0,0 +1,43 @@
package Pear::LocalLoop::Schema::ResultSet::ImportSet;
use strict;
use warnings;
use base 'DBIx::Class::ResultSet';
sub get_values {
my $self = shift;
my $id = shift;
return $self->find($id)->search_related(
'values',
undef,
{
order_by => { -asc => 'id' },
},
);
}
sub get_users {
my $self = shift;
my $id = shift;
return $self->get_values($id)->search({},
{
group_by => 'user_name',
},
);
}
sub get_orgs {
my $self = shift;
my $id = shift;
return $self->get_values($id)->search({},
{
group_by => 'org_name',
},
);
}
1;