Bug 34468

Summary: Add a progress callback to job_progress.js
Product: Koha Reporter: Pedro Amorim <pedro.amorim>
Component: Architecture, internals, and plumbingAssignee: Pedro Amorim <pedro.amorim>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: david, fridolin.somers, jonathan.druart, jonathan.field, kyle, martin.renvoize, matt.blenkinsop
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34364
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00
Circulation function:
Bug Depends on: 31666    
Bug Blocks: 34587, 34788    
Attachments: Bug 34468: Add progress callback to job_progress.js
Bug 34468: Update how we call updateProgress in stage-marc-import.tt
Bug 34468: Add progress callback to job_progress.js
Bug 34468: Update how we call updateProgress in stage-marc-import.tt
Bug 34468: Add progress callback to job_progress.js
Bug 34468: Update how we call updateProgress in stage-marc-import.tt

Description Pedro Amorim 2023-08-03 10:10:52 UTC

    
Comment 1 Pedro Amorim 2023-08-03 10:12:34 UTC
Created attachment 154216 [details] [review]
Bug 34468: Add progress callback to job_progress.js
Comment 2 Pedro Amorim 2023-08-03 10:12:37 UTC
Created attachment 154217 [details] [review]
Bug 34468: Update how we call updateProgress in stage-marc-import.tt
Comment 3 Pedro Amorim 2023-08-03 10:14:12 UTC
Calling anyone who can SO/QA this by testing the stage marc import tool and progress bar.
Comment 4 Pedro Amorim 2023-08-03 10:14:29 UTC
This is something we're using/need for ERM Usage Statistics.
Comment 5 David Nind 2023-08-08 19:13:01 UTC
If you could add a test plan, I'll happily have a go at testing.

For example, what it does, and what to expect before and after the patches are applied.
Comment 6 Pedro Amorim 2023-08-09 08:24:16 UTC
(In reply to David Nind from comment #5)
> If you could add a test plan, I'll happily have a go at testing.
> 
> For example, what it does, and what to expect before and after the patches
> are applied.

Hi David, thank you!

These patches change the current updateProgress function to accept a progress callback (a function that is called every time the bar progresses) in addition to the already existing callback that is called when the progress bar finishes.

It's not expected to change any current behavior in master because updateProgress is only used once in the stage marc import tool using the already existing callback, and these patches aim to keep that.

I think the most appropriate test plan here is to make sure it doesn't break existing functionality, by using the test plan in bug 31666 : 

Test Plan:
1) Apply this patch
2) Stage a marc batch ( preferrably a large one to show the progress updating )
3) Note the new progess bar, verify it functions correctly.
Comment 7 Owen Leonard 2023-08-24 13:37:35 UTC
Does this patch affect the progress bar when uploading the MARC file or the progress bar shown when staging the file for import?
Comment 8 Pedro Amorim 2023-08-24 13:59:28 UTC
(In reply to Owen Leonard from comment #7)
> Does this patch affect the progress bar when uploading the MARC file or the
> progress bar shown when staging the file for import?

It should not change any current behavior, no. This is only a preparation bug for bug 34587 that changes updateProgress to accept an array of callbacks, instead of just a callback.
Comment 9 Owen Leonard 2023-08-24 14:48:10 UTC
Created attachment 154739 [details] [review]
Bug 34468: Add progress callback to job_progress.js

These patches change the current updateProgress function to accept a
progress callback (a function that is called every time the bar
progresses) in addition to the already existing callback that is called
when the progress bar finishes.

It's not expected to change any current behavior in master because
updateProgress is only used once in the stage marc import tool using
the already existing callback, and these patches aim to keep that.

Test Plan:
1) Apply this patch
2) Stage a marc batch ( preferrably a large one to show the progress
   updating )
3) Note the new progess bar, verify it functions correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 10 Owen Leonard 2023-08-24 14:48:12 UTC
Created attachment 154740 [details] [review]
Bug 34468: Update how we call updateProgress in stage-marc-import.tt

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 11 Martin Renvoize (ashimema) 2023-10-20 13:53:50 UTC
Created attachment 157517 [details] [review]
Bug 34468: Add progress callback to job_progress.js

These patches change the current updateProgress function to accept a
progress callback (a function that is called every time the bar
progresses) in addition to the already existing callback that is called
when the progress bar finishes.

It's not expected to change any current behavior in master because
updateProgress is only used once in the stage marc import tool using
the already existing callback, and these patches aim to keep that.

Test Plan:
1) Apply this patch
2) Stage a marc batch ( preferrably a large one to show the progress
   updating )
3) Note the new progess bar, verify it functions correctly.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 12 Martin Renvoize (ashimema) 2023-10-20 13:53:52 UTC
Created attachment 157518 [details] [review]
Bug 34468: Update how we call updateProgress in stage-marc-import.tt

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize (ashimema) 2023-10-20 13:54:53 UTC
All working as described and a positive change.

No regressions found, QA scripts happy.

Passing QA
Comment 14 Tomás Cohen Arazi (tcohen) 2023-10-25 14:49:10 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 15 Fridolin Somers 2023-10-26 08:31:31 UTC
Enhancement not pushed to 23.05.x