This appears to be a bug, the list of servers is retrieved from the database in order, however, it is stored in an unordered object, so the lists are posted to the page in a random order.
When performing a Z39.50 search from within the Advanced Cataloging Editor the list of servers displays in the order that you added them in Z39.50 admin rather than in alphabetical order or by the ranking assigned to the server. This causes us to have to scroll up and down to find a server or do a CTRL-F to find it. It would be more efficient to display the servers in alphabetical order by name of server or to actually use the rank assigned to the server. .
Created attachment 112583 [details] [review] Bug 17151: Order Z3950 server by rank and preserve ordering Previously we put all the servers into an object with keys of the server id This patch converts it to an array of objects to preserve order, and adjusts code to use the array index where necessary and store the server id within the array To test: 1 - Add some new Z3950 servers, they don't need to be valid FIRST SECOND THIRD FOURTH 2 - Adjust the ranking so FOURTH:1 THIRD:2 SECOND:3 FIRST:4 3 - Enable and launch the advanced editor 4 - Click 'Advanced' under search on the left 5 - Note the list displays in the order you entered the servers 6 - Apply patch 7 - Reload 8 - Order is correct 9 - With valid servers, confirm that searching still works and servers can be checked or unchecked to include/remove from results
Created attachment 112585 [details] [review] Bug 17515: Order Z3950 server by rank and preserve ordering Previously we put all the servers into an object with keys of the server id This patch converts it to an array of objects to preserve order, and adjusts code to use the array index where necessary and store the server id within the array To test: 1 - Add some new Z3950 servers, they don't need to be valid FIRST SECOND THIRD FOURTH 2 - Adjust the ranking so FOURTH:1 THIRD:2 SECOND:3 FIRST:4 3 - Enable and launch the advanced editor 4 - Click 'Advanced' under search on the left 5 - Note the list displays in the order you entered the servers 6 - Apply patch 7 - Reload 8 - Order is correct 9 - With valid servers, confirm that searching still works and servers can be checked or unchecked to include/remove from results
Created attachment 112592 [details] [review] Bug 17515: Order Z3950 server by rank and preserve ordering Previously we put all the servers into an object with keys of the server id This patch converts it to an array of objects to preserve order, and adjusts code to use the array index where necessary and store the server id within the array To test: 1 - Add some new Z3950 servers, they don't need to be valid FIRST SECOND THIRD FOURTH 2 - Adjust the ranking so FOURTH:1 THIRD:2 SECOND:3 FIRST:4 3 - Enable and launch the advanced editor 4 - Click 'Advanced' under search on the left 5 - Note the list displays in the order you entered the servers 6 - Apply patch 7 - Reload 8 - Order is correct 9 - With valid servers, confirm that searching still works and servers can be checked or unchecked to include/remove from results https://bugs.koha-community.org/show_bug.cgi?id=17515 Signed-off-by: B Johnson <barbara.johnson@bedfordtx.gov>
I signed off on this bug because the test plan worked as described. One thing to note is that if you rank some of the servers and not others the list displays with the unranked servers first in alphabetical order followed by the ranked servers in rank order. Additionally you can leave all of the servers unranked and they will display in alphabetical order.
(In reply to Barbara Johnson from comment #5) > I signed off on this bug because the test plan worked as described. One > thing to note is that if you rank some of the servers and not others the > list displays with the unranked servers first in alphabetical order followed > by the ranked servers in rank order. Additionally you can leave all of the > servers unranked and they will display in alphabetical order. This seems to match what is done for the other Z39 search so I figured it was best to work towards consistency, and we can improve on another bug if needed
I notice that this moves "Local catalog" to the top from the bottom. But I think I like this change.
Created attachment 112805 [details] [review] Bug 17515: Order Z3950 server by rank and preserve ordering Previously we put all the servers into an object with keys of the server id This patch converts it to an array of objects to preserve order, and adjusts code to use the array index where necessary and store the server id within the array To test: 1 - Add some new Z3950 servers, they don't need to be valid FIRST SECOND THIRD FOURTH 2 - Adjust the ranking so FOURTH:1 THIRD:2 SECOND:3 FIRST:4 3 - Enable and launch the advanced editor 4 - Click 'Advanced' under search on the left 5 - Note the list displays in the order you entered the servers 6 - Apply patch 7 - Reload 8 - Order is correct 9 - With valid servers, confirm that searching still works and servers can be checked or unchecked to include/remove from results https://bugs.koha-community.org/show_bug.cgi?id=17515 Signed-off-by: B Johnson <barbara.johnson@bedfordtx.gov> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 20.11, thanks to everybody involved!
backported to 20.05.x for 20.05.06
enhancement, not backported to 19.11.x
This introduces a regression since "rank" is a reserved keyword in MySQL 8. See bug 23997