From d718cfee42487aea38de536e6187b587143184f1 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 23 Nov 2017 16:52:33 +0000 Subject: [PATCH] Fixed issue with Importset for users and orgs trying to much data for the group by --- .../LocalLoop/Schema/ResultSet/ImportSet.pm | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm b/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm index 785aa99..2ef3e75 100644 --- a/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm +++ b/lib/Pear/LocalLoop/Schema/ResultSet/ImportSet.pm @@ -23,12 +23,28 @@ sub get_values { ); } +sub _unordered_get_values { + my $self = shift; + my $id = shift; + my $include_ignored = shift; + my $include_imported = shift; + + return $self->find($id)->search_related( + 'values', + { + ( $include_ignored ? () : ( ignore_value => 0 ) ), + ( $include_imported ? () : ( transaction_id => undef ) ), + }, + ); +} + sub get_users { my $self = shift; - return $self->get_values(@_)->search({}, + return $self->_unordered_get_values(@_)->search({}, { group_by => 'user_name', + columns => [ qw/ user_name / ], }, ); } @@ -36,9 +52,10 @@ sub get_users { sub get_orgs { my $self = shift; - return $self->get_values(@_)->search({}, + return $self->_unordered_get_values(@_)->search({}, { group_by => 'org_name', + columns => [ qw/ org_name / ], }, ); }