Bug 35430

Summary: Add endpoints for managing stock rotation rota's
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: REST APIAssignee: Martin Renvoize (ashimema) <martin.renvoize>
Status: Pushed to main --- QA Contact: Kyle M Hall (khall) <kyle>
Severity: enhancement    
Priority: P5 - low CC: david, kyle, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement adds API endpoints for managing stock rotation rotas.
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on: 11897    
Bug Blocks:    
Attachments: Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation
Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation
Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation
Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation
Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation
Bug 35430: (follow-up) Remove 'me' from query in tests
Bug 35430: Move 'Stage' into StockRotation directory
Bug 35430: Add unit tests for new stockrotation endpoints
Bug 35430: Add rota endpoints for stockrotation

Description Martin Renvoize (ashimema) 2023-11-29 11:51:27 UTC
One endpoint for stockrotation already exists and was an early addition to the REST api's.

We aught to complete the set and add endpoints for fetching and working with rota's.
Comment 1 Martin Renvoize (ashimema) 2023-11-29 17:36:16 UTC Comment hidden (obsolete)
Comment 2 Martin Renvoize (ashimema) 2023-11-29 17:36:18 UTC Comment hidden (obsolete)
Comment 3 Martin Renvoize (ashimema) 2023-11-29 17:36:21 UTC Comment hidden (obsolete)
Comment 4 Martin Renvoize (ashimema) 2023-11-29 17:37:28 UTC
Test plan.. run the included unit tests and ensure they pass ;P
Comment 5 Martin Renvoize (ashimema) 2023-11-29 17:40:09 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize (ashimema) 2023-11-29 17:40:12 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize (ashimema) 2023-11-29 17:40:14 UTC Comment hidden (obsolete)
Comment 8 Martin Renvoize (ashimema) 2023-11-30 13:59:10 UTC
This is especially useful as it is for EDI users using the LRP segment to auto-populate rotation plans on ordering.

Vendors could use the Fetch API to populate the LRP options pick list in their portals.
Comment 9 David Nind 2023-11-30 18:54:00 UTC
Created attachment 159418 [details] [review]
Bug 35430: Move 'Stage' into StockRotation directory

Cleaning up a little, I opt to move the 'Stage' controller under a new
StockRotation parent directory.

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2023-11-30 18:54:02 UTC
Created attachment 159419 [details] [review]
Bug 35430: Add unit tests for new stockrotation endpoints

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2023-11-30 18:54:05 UTC
Created attachment 159420 [details] [review]
Bug 35430: Add rota endpoints for stockrotation

This patch adds the CRUD endpoints for stock rotation rota's.

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2023-11-30 18:57:14 UTC
Testing notes (using KTD):

1. After apply the patch, run the new tests - these should pass: 
   prove t/db_dependent/api/v1/stockrotation_rotas.t
Comment 13 Kyle M Hall (khall) 2024-03-29 13:53:17 UTC
Created attachment 164134 [details] [review]
Bug 35430: Move 'Stage' into StockRotation directory

Cleaning up a little, I opt to move the 'Stage' controller under a new
StockRotation parent directory.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Kyle M Hall (khall) 2024-03-29 13:53:23 UTC
Created attachment 164135 [details] [review]
Bug 35430: Add unit tests for new stockrotation endpoints

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 15 Kyle M Hall (khall) 2024-03-29 13:53:25 UTC
Created attachment 164136 [details] [review]
Bug 35430: Add rota endpoints for stockrotation

This patch adds the CRUD endpoints for stock rotation rota's.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 16 Katrin Fischer 2024-04-22 10:22:40 UTC
I am sorry, unit tests are failing, can you please have a look?

Running tests (1)
	* Proving /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t KO!

     #   Failed test 'exact match for JSON Pointer ""'
    #   at /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t line 88.
     #     Structures begin differing at:
    #          $got->[2] = HASH(0x56028e088858)
    #     $expected->[2] = Does not exist
     # Looks like you failed 1 test of 20.
 
 #   Failed test 'list() tests'
#   at /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t line 102.
 # Looks like you failed 1 test of 5.
 /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t .. 
 Dubious, test returned 1 (wstat 256, 0x100)
 Failed 1/5 subtests
Comment 17 Martin Renvoize (ashimema) 2024-04-25 12:42:31 UTC
1538 commits since I last rebased the patch.. not all that surprising.
Comment 18 Martin Renvoize (ashimema) 2024-04-25 12:54:45 UTC
Created attachment 165538 [details] [review]
Bug 35430: Move 'Stage' into StockRotation directory

Cleaning up a little, I opt to move the 'Stage' controller under a new
StockRotation parent directory.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 19 Martin Renvoize (ashimema) 2024-04-25 12:54:47 UTC
Created attachment 165539 [details] [review]
Bug 35430: Add unit tests for new stockrotation endpoints

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 20 Martin Renvoize (ashimema) 2024-04-25 12:54:50 UTC
Created attachment 165540 [details] [review]
Bug 35430: Add rota endpoints for stockrotation

This patch adds the CRUD endpoints for stock rotation rota's.

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 21 Martin Renvoize (ashimema) 2024-04-25 12:54:53 UTC
Created attachment 165541 [details] [review]
Bug 35430: (follow-up) Remove 'me' from query in tests
Comment 22 Katrin Fischer 2024-04-26 15:01:35 UTC
I have a failing test with this patch set applied, please check!

Running tests (1)
	* Proving /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t KO!

    #   Failed test 'exact match for JSON Pointer ""'
    #   at /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t line 88.
    #     Structures begin differing at:
    #          $got->[2] = HASH(0x55687bdd94d8)
    #     $expected->[2] = Does not exist
     # Looks like you failed 1 test of 20.
 
#   Failed test 'list() tests'
#   at /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t line 102.
 # Looks like you failed 1 test of 5.
 /kohadevbox/koha/t/db_dependent/api/v1/stockrotation_rotas.t .. 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/5 subtests
Comment 23 Martin Renvoize (ashimema) 2024-04-27 06:50:04 UTC
I don't understand this failure.. I have "me." In the query and it passes sometimes fails others.. I remove the "me." And it passes sometimes, fails others.

Any thoughts Tomas, I'm stuck
Comment 24 Martin Renvoize (ashimema) 2024-06-27 15:39:50 UTC
Created attachment 168202 [details] [review]
Bug 35430: Move 'Stage' into StockRotation directory

Cleaning up a little, I opt to move the 'Stage' controller under a new
StockRotation parent directory.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 25 Martin Renvoize (ashimema) 2024-06-27 15:39:53 UTC
Created attachment 168203 [details] [review]
Bug 35430: Add unit tests for new stockrotation endpoints

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 26 Martin Renvoize (ashimema) 2024-06-27 15:39:56 UTC
Created attachment 168204 [details] [review]
Bug 35430: Add rota endpoints for stockrotation

This patch adds the CRUD endpoints for stock rotation rota's.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 27 Martin Renvoize (ashimema) 2024-06-27 15:40:21 UTC
It wasn't the 'me' at all.. it was the mocked object call.

Anyway.. it works consistently now.
Comment 28 Katrin Fischer 2024-06-28 11:50:12 UTC
Pushed for 24.11!

Well done everyone, thank you!