Bugzilla – Attachment 139797 Details for
Bug 27421
Porting tools/stage-marc-import.pl to BackgroundJob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27421: (QA follow-up) WIP: Adjusting progress and size
Bug-27421-QA-follow-up-WIP-Adjusting-progress-and-.patch (text/plain), 3.60 KB, created by
Marcel de Rooy
on 2022-08-25 14:38:12 UTC
(
hide
)
Description:
Bug 27421: (QA follow-up) WIP: Adjusting progress and size
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-25 14:38:12 UTC
Size:
3.60 KB
patch
obsolete
>From d7d99ded1fe5ce47af333a561fa31e9910bcfdff Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 19 Aug 2022 07:54:55 +0000 >Subject: [PATCH] Bug 27421: (QA follow-up) WIP: Adjusting progress and size >Content-Type: text/plain; charset=utf-8 > >Might still need a bit of polishing. >--- > Koha/BackgroundJob/MARCImportCommitBatch.pm | 8 ++++---- > Koha/BackgroundJob/MARCImportRevertBatch.pm | 10 ++++++---- > Koha/BackgroundJob/StageMARCForImport.pm | 1 + > 3 files changed, 11 insertions(+), 8 deletions(-) > >diff --git a/Koha/BackgroundJob/MARCImportCommitBatch.pm b/Koha/BackgroundJob/MARCImportCommitBatch.pm >index 57faa99c51..94d492e732 100644 >--- a/Koha/BackgroundJob/MARCImportCommitBatch.pm >+++ b/Koha/BackgroundJob/MARCImportCommitBatch.pm >@@ -65,14 +65,14 @@ sub process { > my ( $num_added, $num_updated, $num_items_added, > $num_items_replaced, $num_items_errored, $num_ignored ); > try { >- my $size = Koha::Import::Records->search({ import_batch_id => $import_batch_id })->count; >- $self->size($size)->store; > ( > $num_added, $num_updated, $num_items_added, > $num_items_replaced, $num_items_errored, $num_ignored > ) > = BatchCommitRecords( $import_batch_id, $frameworkcode, 50, > sub { my $job_progress = shift; $self->progress( $job_progress )->store } ); >+ my $count = $num_added + $num_updated; >+ $self->set({ progress => $count, size => $count })->store if $count; > } > catch { > warn $_; >@@ -106,8 +106,8 @@ sub enqueue { > my ( $self, $args) = @_; > > $self->SUPER::enqueue({ >- job_size => 0, # unknown for now >- job_args => $args >+ job_size => Koha::Import::Records->search({ import_batch_id => $args->{import_batch_id} })->count, >+ job_args => $args, > }); > } > >diff --git a/Koha/BackgroundJob/MARCImportRevertBatch.pm b/Koha/BackgroundJob/MARCImportRevertBatch.pm >index bd125a07e8..d6d88bea1a 100644 >--- a/Koha/BackgroundJob/MARCImportRevertBatch.pm >+++ b/Koha/BackgroundJob/MARCImportRevertBatch.pm >@@ -23,6 +23,7 @@ use base 'Koha::BackgroundJob'; > use C4::ImportBatch qw( > BatchRevertRecords > ); >+use Koha::Import::Records; > > =head1 NAME > >@@ -68,8 +69,9 @@ sub process { > ( > $num_deleted, $num_errors, $num_reverted, > $num_items_deleted, $num_ignored >- ) = BatchRevertRecords( $import_batch_id, 50, >- sub { my $job_progress = shift; $self->progress( $job_progress )->store } ); >+ ) = BatchRevertRecords( $import_batch_id ); # TODO BatchRevertRecords still needs a progress_callback >+ my $count = $num_deleted + $num_reverted; >+ $self->set({ progress => $count, size => $count })->store if $count; > } > catch { > warn $_; >@@ -103,8 +105,8 @@ sub enqueue { > my ( $self, $args) = @_; > > $self->SUPER::enqueue({ >- job_size => 0, # unknown for now >- job_args => $args >+ job_size => Koha::Import::Records->search({ import_batch_id => $args->{import_batch_id} })->count, >+ job_args => $args, > }); > } > >diff --git a/Koha/BackgroundJob/StageMARCForImport.pm b/Koha/BackgroundJob/StageMARCForImport.pm >index a2c12a78fd..853530587e 100644 >--- a/Koha/BackgroundJob/StageMARCForImport.pm >+++ b/Koha/BackgroundJob/StageMARCForImport.pm >@@ -125,6 +125,7 @@ sub process { > $self->progress( int($job_progress) )->store; > } > ); >+ $self->set({ progress => $num_valid, size => $num_valid })->store if $num_valid; > > if ($profile_id) { > my $ibatch = Koha::ImportBatches->find($batch_id); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27421
:
136127
|
136128
|
136129
|
136216
|
136217
|
136338
|
136339
|
138642
|
138643
|
138656
|
138657
|
138660
|
138881
|
139384
|
139385
|
139386
|
139387
|
139388
|
139448
|
139449
|
139450
|
139797
|
140205
|
140206
|
140207
|
140208
|
140223
|
140224
|
140225
|
140226
|
140227
|
140228
|
140229
|
140230
|
140231
|
140232
|
140233
|
140234
|
140759