Bug 13214 - Improve performance of acqui/addorderiso2709.pl, stop fetching all import_records needlessly

TEST PLAN:

1. Load 167 staged files to Koha.
2. Try to make an acquisiton from a staged file.
3. Wait 16s for the acqui/addorderiso2709.pl -view to load.

AFTER PATCH:

1. Load 167 staged files to Koha.
2. Try to make an acquisiton from a staged file.
3. Wait 1.6s for the acqui/addorderiso2709.pl -view to load.

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Olli-Antti Kivilahti 2014-11-06 16:38:37 +02:00 committed by Tomas Cohen Arazi
parent 9419177a1e
commit e232f3b64a

View file

@ -331,7 +331,7 @@ sub import_batches_list {
foreach my $batch (@$batches) {
if ( $batch->{'import_status'} =~ /^staged$|^reverted$/ ) {
# check if there is at least 1 line still staged
my $stagedList=GetImportRecordsRange($batch->{'import_batch_id'}, undef, undef, $batch->{import_status}, { order_by_direction => 'ASC' });
my $stagedList=GetImportRecordsRange($batch->{'import_batch_id'}, undef, 1, $batch->{import_status}, { order_by_direction => 'ASC' });
if (scalar @$stagedList) {
push @list, {
import_batch_id => $batch->{'import_batch_id'},