Bug 19037

Summary: Circulation and fine rules test tool
Product: Koha Reporter: Lari Taskula <lari.taskula>
Component: System AdministrationAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: alex, alexbuckley, andrew, barbara.johnson, cbrannon, chanel.wheeler, emmi.takkinen, george, gmcharlt, josef.moravec, kbecker, kebliss, lauren_denny, lisette, marjorie.barry-vila, martin.renvoize, mkstephens, mtj, nick, rcoert, severine.queune, shi-yao.wang, veron
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18139
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36641
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 36641    
Bug Blocks:    
Attachments: example screenshot
Bug 19037: Issuing rules test tool - REST API endpoint for effective issuing rule
KD-2316: Issuing rules test tool - GUI for test tool
Bug 19037: Issuing rules test tool - GUI for test tool
Bug 19037: Issuing rules test tool - GUI for test tool
Bug 19037: Issuing rules test tool - GUI for test tool
Bug 19037: Update to use PQA api endpoint and modern styling
Bug 19037: Issuing rules test tool - GUI for test tool
Bug 19037: Update to use PQA api endpoint and modern styling
Bug 19037: Move test tool to includes
Bug 19037: Update for change of API response

Description Lari Taskula 2017-08-04 12:23:46 UTC
Add a test tool for circulation and fine rules. The point of the tool is to display the effective issuing rule that matches item, patron and branch.

Add a REST API endpoint to query effective issuing rules by given parameters.
Comment 1 Lari Taskula 2017-08-04 12:24:29 UTC
Created attachment 65497 [details]
example screenshot
Comment 2 Lari Taskula 2017-08-04 12:31:06 UTC
This has been implement but needs a rebase to be suitable for applying on master. It uses REST API and requires Bug 18137. Code of our current implementation for the API endpoint is here
https://github.com/KohaSuomi/Koha/commit/fc9f92651a39bf371cfde10fd46abdeb81e212ec

...and the GUI here 
https://github.com/KohaSuomi/Koha/commit/d089582e32d98fcd82e544b8a51aedcb7da3ba90

Attached a screenshot so you can see how it looks.
Comment 3 Lari Taskula 2017-08-06 23:16:53 UTC
Created attachment 65523 [details] [review]
Bug 19037: Issuing rules test tool - REST API endpoint for effective issuing rule

To test:
1. prove t/db_dependent/api/v1/issuingrules.t
2. Send GET requests to /api/v1/issuingrules/effective with different parameters
   as defined in the path's Swagger spec
3. Make sure it returns the correct issuing rules (don't forget that system prefs
   like CircControl and HomeOrHoldingBranch affects the result)
Comment 4 Lari Taskula 2017-08-06 23:17:14 UTC Comment hidden (obsolete)
Comment 5 Lari Taskula 2017-08-06 23:18:03 UTC Comment hidden (obsolete)
Comment 6 Lari Taskula 2017-08-06 23:18:51 UTC
Created attachment 65526 [details] [review]
Bug 19037: Issuing rules test tool - GUI for test tool

To test:
1. Go to INTRANET/cgi-bin/koha/admin/smart-rules.pl
2. You should see a button below circulation rules matrix
   "Circulation and fine rules test tool"
3. Click it
4. You should see options for inputting test patron, item and branch
5. Play with the tester and make sure it returns correct issuing rules
   (CircControl and HomeOrHoldingBranch system preferences affects the result)
Comment 7 Lari Taskula 2017-08-06 23:27:04 UTC
Testing this tool requires Bug 18137. It has some Perl dependencies, please see the patch called "List Mojolicious::Plugin::OpenAPI and JSON::Validator as dependencies" for versions of dependencies that are confirmed to work. Make sure to install those versions or otherwise the endpoint (and the tool) may not work.
Comment 8 Alex Buckley 2017-10-23 10:04:20 UTC
Hi Lari

When applying these patches I found that they threw an error even though I had the dependencies in my branch:

Applying: Bug 19037: Issuing rules test tool - REST API endpoint for effective issuing rule
fatal: sha1 information is lacking or useless (t/db_dependent/api/v1/cities.t).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Bug 19037: Issuing rules test tool - REST API endpoint for effective issuing rule
The copy of the patch that failed is found in:
   /home/vagrant/kohaclone/.git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-19037-Issuing-rules-test-tool---REST-API-endpo-M5ZrDP.patch
Comment 9 Christopher Brannon 2020-07-22 14:32:23 UTC
*** Bug 26034 has been marked as a duplicate of this bug. ***
Comment 10 Christopher Brannon 2024-01-18 20:29:29 UTC
Looking forward to this enhancement.
Comment 11 Chanel Wheeler 2024-04-11 15:19:49 UTC
We had this in Symphony and it was a life saver. Very much looking forward to this.
Comment 12 Alex Carver 2024-05-04 23:59:53 UTC
+1 from RCLS
Comment 13 Lari Taskula 2024-05-05 16:20:35 UTC
Thank you for the recent interest.

Sadly this is not currently in my to-do list, but if someone wants to take over this Bug, please do!
Comment 14 Martin Renvoize (ashimema) 2024-07-03 13:21:58 UTC
Created attachment 168450 [details] [review]
Bug 19037: Issuing rules test tool - GUI for test tool

To test:
1. Go to INTRANET/cgi-bin/koha/admin/smart-rules.pl
2. You should see a button below circulation rules matrix
   "Circulation and fine rules test tool"
3. Click it
4. You should see options for inputting test patron, item and branch
5. Play with the tester and make sure it returns correct issuing rules
   (CircControl and HomeOrHoldingBranch system preferences affects the result)
Comment 15 Martin Renvoize (ashimema) 2024-07-03 13:22:04 UTC
Created attachment 168451 [details] [review]
Bug 19037: Update to use PQA api endpoint and modern styling

This patch updates the test tool to use the recently introduced API
endpoint.

TODO: This works nicely with 'Categorycode', 'Itemtype' and 'Library'
selection right now, but does not yet work for the other select options
in the tester.
Comment 16 Martin Renvoize (ashimema) 2024-07-03 13:24:22 UTC
Would mind a bit of help cleaning this up.. the basics are working again but it needs some refinement around the select options that are exposed..
Comment 17 Martin Renvoize (ashimema) 2024-07-16 06:24:14 UTC
Created attachment 169037 [details] [review]
Bug 19037: Issuing rules test tool - GUI for test tool

To test:
1. Go to INTRANET/cgi-bin/koha/admin/smart-rules.pl
2. You should see a button below circulation rules matrix
   "Circulation and fine rules test tool"
3. Click it
4. You should see options for inputting test patron, item and branch
5. Play with the tester and make sure it returns correct issuing rules
   (CircControl and HomeOrHoldingBranch system preferences affects the result)
Comment 18 Martin Renvoize (ashimema) 2024-07-16 06:24:18 UTC
Created attachment 169038 [details] [review]
Bug 19037: Update to use PQA api endpoint and modern styling

This patch updates the test tool to use the recently introduced API
endpoint.

TODO: This works nicely with 'Categorycode', 'Itemtype' and 'Library'
selection right now, but does not yet work for the other select options
in the tester.
Comment 19 Martin Renvoize (ashimema) 2024-07-16 06:24:22 UTC
Created attachment 169039 [details] [review]
Bug 19037: Move test tool to includes
Comment 20 Martin Renvoize (ashimema) 2024-07-16 06:24:26 UTC
Created attachment 169040 [details] [review]
Bug 19037: Update for change of API response
Comment 21 Shi Yao Wang 2024-09-26 17:24:00 UTC
I only get "undefined" box after clicking "find" in the tool.
Also, the tool is always visible in my case so step 2 and 3 were confusing.
Comment 22 Andrew Fuerste-Henry 2024-11-04 16:50:19 UTC
I am also getting "undefined" on all tests.

The rule tester is showing right away on page load and is above the actual circ rules. Your test plan suggests you intended it to be hidden on page load and beneath the circ rules, which would both be great.

(In reply to Shi Yao Wang from comment #21)
> I only get "undefined" box after clicking "find" in the tool.
> Also, the tool is always visible in my case so step 2 and 3 were confusing.