Bug 6372

Summary: Batch progress bar does not check for 0 size jobs; should be in separate js too
Product: Koha Reporter: Srdjan Jankovic <srdjan>
Component: ToolsAssignee: Srdjan Jankovic <srdjan>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: minor    
Priority: P5 - low CC: chris, jcamins, jonathan.druart, koha.sekjal, paul.poulain, wizzyrea
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Who signed the patch off: Text to go in the release notes:
Version(s) released in:
Attachments: p
patch
bug 6372: moved background-job.inc to background-job-progressbar.js
patch
bug 6372: moved background-job.inc to background-job-progressbar.js

Description Srdjan Jankovic 2011-05-19 07:09:52 UTC
Batch progress bar does not check for 0 size jobs, and divides by 0, with unpredictable effects.
Also, putting progress bar javascript inline makes it impossible to debug.

It is possible that this change will improve situation with some bugs reported against background jobs that use progress bar.
Comment 1 Srdjan Jankovic 2011-05-19 07:32:44 UTC Comment hidden (obsolete)
Comment 2 Srdjan Jankovic 2012-02-13 07:46:09 UTC Comment hidden (obsolete)
Comment 3 Jared Camins-Esakov 2012-03-10 16:20:43 UTC Comment hidden (obsolete)
Comment 4 Ian Walls 2012-03-16 17:34:55 UTC
Scanning for remaining instances of [% INCLUDE 'background-job.inc' %], I found one left in:

koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt
Comment 5 Srdjan Jankovic 2012-03-23 00:17:00 UTC Comment hidden (obsolete)
Comment 6 Liz Rea 2012-04-10 15:09:20 UTC
Created attachment 9076 [details] [review]
bug 6372: moved background-job.inc to background-job-progressbar.js

Check for div 0 when calculating percentage

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
div0 no longer appears on 0 size jobs.
Passes t xt
Comment 7 Jonathan Druart 2012-05-03 14:46:26 UTC
QA comment:
- Move background job javascript code into a js file.
- Delete useless routine progress_callback (batchmod.pl)
- Fix the specific case where there is no job to process
Marked as Passed QA
Comment 8 Paul Poulain 2012-05-07 21:15:11 UTC
Patch pushed. I've tested that Koha still works with files that are not of size 0

Note that it's hard to spot the div by 0 in the midlde of the move to .js. Both are perfect things, but it would have been better to do 2 patches