Description
Nick Clemens (kidclamp)
2025-08-14 16:59:42 UTC
This is because when rank-request is changed there is JS to move the entire row with insertBefore/insertAfter, I don't think we should be doing that with a dataTable. Instead we should only be adjusting the other priorities when a change is made to one. Created attachment 185419 [details] [review] Bug 40654: Fix how rank/priority is adjusted when changing from the UI To test: 0 - APPLY PATCH 1 - Place 50 holds on a bib record https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl 2 - View the holds page for the record 3 - Sort the holds alphabetically 4 - Change the dropdown priortiy for the alphabetically first hold to 1 5 - All the priorities should now ajust accordingly but they will NOT be resorted on the fly 6 - Play with adjusting some priorities, making sure everything correctly adjusts. 7 - Click 'Update holds' to make sure the priorities adjust right 8 - Make sure you test with the 'del' option and the adjustments still work. This patch makes it so we no longer move the entire row around, we shouldn't do that in a dataTable. Instead, it recalculates priority for all holds on the record after one priority is changed. Created attachment 185477 [details] [review] Bug 40654: Fix how rank/priority is adjusted when changing from the UI To test: 0 - APPLY PATCH 1 - Place 50 holds on a bib record https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl 2 - View the holds page for the record 3 - Sort the holds alphabetically 4 - Change the dropdown priortiy for the alphabetically first hold to 1 5 - All the priorities should now ajust accordingly but they will NOT be resorted on the fly 6 - Play with adjusting some priorities, making sure everything correctly adjusts. 7 - Click 'Update holds' to make sure the priorities adjust right 8 - Make sure you test with the 'del' option and the adjustments still work. Signed-off-by: David Flater <flaterdavid@gmail.com> Sorting worked correctly for every combination I tested, but there still seems to be some weirdness with the 'del' option. For example: I placed 10 holds on a bib for the following patrons, in the following order: 1. Marie Mcknight 2. Floyd Delgado 3. Joyce Gaines 4. Edna Acosta 5. Henry Acevedo 6. Nicole Schneider 7. Mary Burton 8. Terrence Mcconnell 9. Marilyn Mcfarland 10. Marcus Welch Then sorted the holds table alphabetically: 4. Edna 2. Floyd 5. Henry 3. Joyce 10. Marcus 1. Marie 9. Marilyn 7. Mary 6. Nicole 8. Terrence Next, I used the 'del' option to cancel Floyd's hold, and noticed the following errors in the priority calculation: Name Original Rank Expected Actual Edna 4 3 2 X Henry 5 4 4 Joyce 3 2 3 X Marcus 10 9 7 X Marie 1 1 1 Marilyn 9 8 9 X Mary 7 6 6 Nicole 6 5 5 Terrence 8 7 8 X In other words, Edna skipped ahead to rank 2 instead of 3, pushing Joyce down one. Marcus skipped ahead to rank 7 instead of 9, pushing Marilyn and Terrence down one. Ah! Thanks, Emily. I think I see the problem with the 'del', a fix is incoming! Created attachment 185589 [details] [review] Bug 40654: Fix how rank/priority is adjusted when changing from the UI To test: 0 - APPLY PATCH 1 - Place 50 holds on a bib record https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl 2 - View the holds page for the record 3 - Sort the holds alphabetically 4 - Change the dropdown priortiy for the alphabetically first hold to 1 5 - All the priorities should now ajust accordingly but they will NOT be resorted on the fly 6 - Play with adjusting some priorities, making sure everything correctly adjusts. 7 - Click 'Update holds' to make sure the priorities adjust right 8 - Make sure you test with the 'del' option and the adjustments still work. Signed-off-by: David Flater <flaterdavid@gmail.com> Created attachment 185590 [details] [review] Bug 40654: Fix how rank/priority is adjusted when changing from the UI To test: 0 - APPLY PATCH 1 - Place 50 holds on a bib record https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl 2 - View the holds page for the record 3 - Sort the holds alphabetically 4 - Change the dropdown priortiy for the alphabetically first hold to 1 5 - All the priorities should now ajust accordingly but they will NOT be resorted on the fly 6 - Play with adjusting some priorities, making sure everything correctly adjusts. 7 - Click 'Update holds' to make sure the priorities adjust right 8 - Make sure you test with the 'del' option and the adjustments still work. Signed-off-by: David Flater <flaterdavid@gmail.com> Created attachment 185597 [details] [review] Bug 40654: Adjust display to show current priority Created attachment 185600 [details] [review] Bug 40654: Adjust display to show current priority Created attachment 185605 [details] [review] Bug 40654: Fix how rank/priority is adjusted when changing from the UI To test: 0 - APPLY PATCH 1 - Place 50 holds on a bib record https://github.com/kidclamp/handy-koha-script/blob/main/randhold.pl 2 - View the holds page for the record 3 - Sort the holds alphabetically 4 - Change the dropdown priortiy for the alphabetically first hold to 1 5 - All the priorities should now ajust accordingly but they will NOT be resorted on the fly 6 - Play with adjusting some priorities, making sure everything correctly adjusts. 7 - Click 'Update holds' to make sure the priorities adjust right 8 - Make sure you test with the 'del' option and the adjustments still work. Signed-off-by: David Flater <flaterdavid@gmail.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Created attachment 185606 [details] [review] Bug 40654: Adjust display to show current priority Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> |