From eb2a71ce651c463e0e3f69c73e8f32ac1ffd94ec Mon Sep 17 00:00:00 2001 From: Finn Date: Tue, 9 Jul 2019 13:50:26 +0100 Subject: [PATCH] fixed some api and import stuff --- CHANGELOG.md | 4 ++++ lib/Pear/LocalLoop/Controller/Api/Upload.pm | 6 ++++++ lib/Pear/LocalLoop/Import/LCCCsv/Transactions.pm | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1490668..0863a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # Next Release +* Added proper minion job support +* **Admin Feature** Added importing of CSVs from Lancaster City Council +* Added pagination support to searching of organisations during transaction submission in API + # v0.10.9 * Removed sector list from dashboard stats and swapped it for category list diff --git a/lib/Pear/LocalLoop/Controller/Api/Upload.pm b/lib/Pear/LocalLoop/Controller/Api/Upload.pm index c638645..2bcd161 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Upload.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Upload.pm @@ -265,6 +265,7 @@ sub post_search { $validation->input( $c->stash->{api_json} ); $validation->required('search_name'); + $validation->optional('page')->number; return $c->api_validation_error if $validation->has_error; @@ -276,6 +277,11 @@ sub post_search { my $valid_orgs_rs = $org_rs->search({ pending => 0, entity_id => { "!=" => $user->entity_id }, + }, + { + page => $validation->param('page') || 1, + rows => 10, + order_by => { -desc => 'name' }, })->search( \$search_stmt, ); diff --git a/lib/Pear/LocalLoop/Import/LCCCsv/Transactions.pm b/lib/Pear/LocalLoop/Import/LCCCsv/Transactions.pm index 77d7e92..a143af4 100644 --- a/lib/Pear/LocalLoop/Import/LCCCsv/Transactions.pm +++ b/lib/Pear/LocalLoop/Import/LCCCsv/Transactions.pm @@ -19,7 +19,7 @@ sub import_csv { my ($self) = @_; my $rows = $self->csv_data; - + my $lcc_org = $self->schema->resultset('Organisation')->find({ name => "Lancashire County Council" }); foreach my $row ( @{$rows} ) { $self->_row_to_result($row); }