Bug 31336 - In-progress background jobs give incorrect progress message
Summary: In-progress background jobs give incorrect progress message
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 31245
Blocks: 35092
  Show dependency treegraph
 
Reported: 2022-08-10 13:33 UTC by Andrew Fuerste-Henry
Modified: 2023-10-18 14:49 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2022-08-10 13:33:12 UTC
If one loads the background job details page (background_jobs.pl) for a job that has started but not yet completed, Koha shows a message of "No items modified."

We should give an accurate message along the lines of "This job is still in progress."

A completed job lists all of the modified items/bibs/whatever. I'm ambivalent about whether or not we need to list the already-modified records when loading this page for an incomplete job.

To recreate: 
1 - write a report, SELECT itemnumber FROM items. With the default dev data, that's 961 items.
2 - use your report to send all of those to batch mod. The page will take a while to load
3 - while your batch mod page is loading, open background_jobs.pl in another tab and have it ready to go
4 - modify something in all 961 records -- add a public note or something -- once you submit this job it should take about 45 seconds to complete
5 - BEFORE THE JOB IS DONE - reload background_jobs.pl, see your job is listed and shows status=started. click to the details view for your job, see it shows  a message of "No items modified."
Comment 1 Nick Clemens (kidclamp) 2022-12-05 17:22:25 UTC
Also true for deletion "All records have been deleted successfully!”
Comment 2 Fridolin Somers 2023-06-02 20:50:04 UTC
I rise to major importance, this could lead to misunderstanding.

I see in template :
[% IF job.status != 'new' %][% PROCESS 'report' %][% END %]

https://git.koha-community.org/Koha-community/Koha/src/commit/9c565eff1357c2fdf900f006a17fa62fd4f2f9ee/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt#L99

Should we simply change for job.status finished, canceled or failed ?

Also :
I see some templates are managing the cancel status :

https://git.koha-community.org/Koha-community/Koha/src/commit/00e33f875808761e6a280778842fd28bd5ab27d9/koha-tmpl/intranet-tmpl/prog/en/includes/background_jobs/batch_biblio_record_modification.inc#L24

It is missing in batch biblio record deletion.

Maybe we should change includes to define "report_sucess", "report_canceled" ...
Comment 3 Fridolin Somers 2023-06-02 21:33:01 UTC
Ah also I see the template uses :
    [% SET report = job.report %]
    [% IF report %]

But job.report returns empty hashref :

https://git.koha-community.org/Koha-community/Koha/src/commit/2eca0fe3632bf0ec4396da0c694b9fdbddf9e4df/Koha/BackgroundJob.pm#L339

May we return undef ?