From 6d138af016ba6339449eb2fffe4be1641332d472 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 23 Nov 2017 16:52:33 +0000 Subject: [PATCH 1/3] 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 / ], }, ); } From 1bc56016e7543a436d220dffe8e79d7e285d0c68 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 23 Nov 2017 16:52:52 +0000 Subject: [PATCH 2/3] Fix dev_data Command for testing --- lib/Pear/LocalLoop/Command/dev_data.pm | 54 ++++++++++++++++---------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/lib/Pear/LocalLoop/Command/dev_data.pm b/lib/Pear/LocalLoop/Command/dev_data.pm index 70a5673..5cf079b 100644 --- a/lib/Pear/LocalLoop/Command/dev_data.pm +++ b/lib/Pear/LocalLoop/Command/dev_data.pm @@ -28,45 +28,57 @@ sub run { $schema->resultset('User')->create({ email => 'test@example.com', password => 'abc123', - customer => { - full_name => 'Test User', - display_name => 'Test User', - year_of_birth => 2006, - postcode => 'LA1 1AA', + entity => { + type => 'customer', + customer => { + full_name => 'Test User', + display_name => 'Test User', + year_of_birth => 2006, + postcode => 'LA1 1AA', + } }, - administrator => {}, + is_admin => 1, }); $schema->resultset('User')->create({ email => 'test2@example.com', password => 'abc123', - customer => { - full_name => 'Test User 2', - display_name => 'Test User 2', - year_of_birth => 2006, - postcode => 'LA1 1AA', + entity => { + type => 'customer', + customer => { + full_name => 'Test User 2', + display_name => 'Test User 2', + year_of_birth => 2006, + postcode => 'LA1 1AA', + }, }, }); $schema->resultset('User')->create({ email => 'test3@example.com', password => 'abc123', - customer => { - full_name => 'Test User 3', - display_name => 'Test User 3', - year_of_birth => 2006, - postcode => 'LA1 1AA', + entity => { + type => 'customer', + customer => { + full_name => 'Test User 3', + display_name => 'Test User 3', + year_of_birth => 2006, + postcode => 'LA1 1AA', + }, }, }); $schema->resultset('User')->create({ email => 'testorg@example.com', password => 'abc123', - organisation => { - name => 'Test Org', - street_name => 'Test Street', - town => 'Lancaster', - postcode => 'LA1 1AA', + entity => { + type => 'organisation', + organisation => { + name => 'Test Org', + street_name => 'Test Street', + town => 'Lancaster', + postcode => 'LA1 1AA', + }, }, }); } From 0799d6eeb1391c744de01ec6678893dabc0504cf Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Thu, 23 Nov 2017 17:18:07 +0000 Subject: [PATCH 3/3] Updated changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34f16b9..72fee9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # Next Release +* **Admin Fix**: Fix error in Importing under Postgres + # v0.9.6 * **Admin Feature** Merged organisation lists into one list