Jericho1060 / du-storage-monitoring

a simple storage monitoring for Dual Universe
GNU General Public License v3.0
26 stars 15 forks source link

Default sorting by name within tier incorrect for English #10

Closed markdurley closed 1 year ago

markdurley commented 1 year ago

Version: 4.8.0

With the sorting option "none", the sorting of ingredients by name within tiers is not correct in my English environment.

On my programming board, I changed the following and it seemed to work:

            -- sorting by name
            for k,v in pairs(tiers) do
                table.sort(tiers[k], function(a,b) return a.ingredient.name:lower() < b.ingredient.name:lower() end)
            end

to:

            -- sorting by name
            for k,v in pairs(tiers) do
                table.sort(tiers[k], function(a,b) return a.ingredient.locDisplayNameWithSize:lower() < b.ingredient.locDisplayNameWithSize:lower() end)
            end
Jericho1060 commented 1 year ago

humm i will have a look but with no default sorting enabled, the list is sorted by tier, not by item name so it can be normal the sorting order is not made by name

Jericho1060 commented 1 year ago

ok i have seen the problem, this is a function that shouldn't be here, the real sorting is managed by the screen and the one in unit > start shouldn't be here

I'll fix this asap

Thank you for the report

markdurley commented 1 year ago

I kinda like that that code is there. I leave sorting on "none" to get the tier sort, and that change I described makes it alphabetical within each tier.

BTW I have also made local changes to add colour of the text based on tier. This is less interesting now that you have added the tier number option, but I like how it looks:

image

Let me know if you would like me to share that with you, but I am VERY much a novice with LUA.

Jericho1060 commented 1 year ago

just waiting for the game to be back online to test the fix

Jericho1060 commented 1 year ago

You were right for the sorting, I remember why that one is done here (I moved it on the v5 :D that will come a bit later)

I also added the colors, thank you for the idea (it all in lua parameters, and you can customize the colors)

Also added all these parameters to be saved in the databank for easier later update