Bug 17515 - Advanced Editor - Rancor - Z39 sources not sorted properly
Summary: Advanced Editor - Rancor - Z39 sources not sorted properly
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Nick Clemens
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-27 18:13 UTC by Nick Clemens
Modified: 2020-11-17 20:49 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:
20.11.00, 20.05.06


Attachments
Bug 17151: Order Z3950 server by rank and preserve ordering (8.40 KB, patch)
2020-10-27 16:06 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17515: Order Z3950 server by rank and preserve ordering (8.40 KB, patch)
2020-10-27 16:51 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17515: Order Z3950 server by rank and preserve ordering (8.46 KB, patch)
2020-10-27 19:26 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 17515: Order Z3950 server by rank and preserve ordering (8.51 KB, patch)
2020-11-01 13:29 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2016-10-27 18:13:15 UTC
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.
Comment 1 Barbara Johnson 2020-10-26 17:50:35 UTC
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.
.
Comment 2 Nick Clemens 2020-10-27 16:06:19 UTC
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
Comment 3 Nick Clemens 2020-10-27 16:51:05 UTC
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
Comment 4 ByWater Sandboxes 2020-10-27 19:26:06 UTC
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>
Comment 5 Barbara Johnson 2020-10-27 19:30:34 UTC
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.
Comment 6 Nick Clemens 2020-10-30 11:45:20 UTC
(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
Comment 7 Katrin Fischer 2020-11-01 13:28:01 UTC
I notice that this moves "Local catalog" to the top from the bottom. But I think I like this change.
Comment 8 Katrin Fischer 2020-11-01 13:29:01 UTC
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>
Comment 9 Jonathan Druart 2020-11-02 10:05:15 UTC
Pushed to master for 20.11, thanks to everybody involved!
Comment 10 Lucas Gass 2020-11-16 18:33:44 UTC
backported to 20.05.x for 20.05.06
Comment 11 Aleisha Amohia 2020-11-17 05:14:22 UTC
enhancement, not backported to 19.11.x