Hopefully fix speed issue on external data
This commit is contained in:
parent
3b8b5b97f4
commit
962cf972da
19 changed files with 182 additions and 156 deletions
|
@ -98,4 +98,24 @@ sub post_transactions {
|
|||
return $c->redirect_to('/admin/import_from');
|
||||
}
|
||||
|
||||
sub org_search {
|
||||
my $c = shift;
|
||||
my $term = $c->param('term');
|
||||
|
||||
my $rs = $c->schema->resultset('Organisation')->search(
|
||||
{ name => { like => $term . '%' } },
|
||||
{
|
||||
join => 'entity',
|
||||
columns => [ qw/ me.name entity.id / ]
|
||||
},
|
||||
);
|
||||
|
||||
my @results = ( map { {
|
||||
label => $_->name,
|
||||
value => $_->entity->id,
|
||||
} } $rs->all);
|
||||
|
||||
$c->render( json => \@results );
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Reference in a new issue