Bug 41238: Update progress for peseudonmyzation bacgkround jobs

To test:
Enable pseudonymization, may need to add bcrypt settings (see bug 28911)
Perform some circulations
View the jobs (Admin->Manage jobs)
Filter for Pseudonymize statistic
Note the progress is 0/1 even when job finished
Apply patch, restart all
Do more circulations
Confirm jobs now say 1/1 complete

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2025-11-11 18:52:04 +00:00 committed by Lucas Gass
parent 247a43eca6
commit 82561ff33d
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 5 additions and 2 deletions

View File

@ -53,6 +53,8 @@ sub process {
my $statistic = $args->{statistic};
my $stat_object = Koha::Statistic->new($statistic);
Koha::PseudonymizedTransaction->create_from_statistic($stat_object);
$self->progress(1)
; #We could use step here, but we are going to save the object during finish and this saves a DB write
$self->finish( { data => "" } ); # We want to clear the job data to avoid storing patron information
}

View File

@ -68,7 +68,7 @@ subtest 'enqueue() tests' => sub {
subtest 'process() tests' => sub {
plan tests => 3;
plan tests => 4;
$schema->storage->txn_begin;
@ -103,7 +103,8 @@ subtest 'process() tests' => sub {
is( $statistic->{datetime}, $pt_after->last->datetime, "'datetime' column preserved" );
$job->discard_changes;
is( $job->data, '{"data":""}', "Job data cleared after pseudonymization" );
is( $job->data, '{"data":""}', "Job data cleared after pseudonymization" );
is( $job->progress, 1, "Job progress is updated" );
$schema->storage->txn_rollback;
};