Further work on import functions
This commit is contained in:
parent
593efcedfa
commit
9096bef00d
9 changed files with 382 additions and 0 deletions
43
lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm
Normal file
43
lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm
Normal 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;
|
Reference in a new issue