From 14d027a0362c4cdc6aef3027f18104743309ae2e Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 26 Mar 2024 13:36:44 +0100 Subject: [PATCH] FileChooser: collate: use local variable instead of directly assigning --- frontend/ui/widget/filechooser.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 31062c6a4..1f5751523 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -230,6 +230,7 @@ local FileChooser = Menu:extend{ end, item_func = function(item) local percent_finished + local sort_percent item.opened = DocSettings:hasSidecarFile(item.path) if item.opened then local doc_settings = DocSettings:open(item.path) @@ -237,15 +238,15 @@ local FileChooser = Menu:extend{ -- books marked as "finished" or "on hold" should be considered the same as 100% and 0% respectively if summary and summary.status == "complete" then - item.sort_percent = 1.0 + sort_percent = 1.0 elseif summary and summary.status == "abandoned" then - item.sort_percent = 0 + sort_percent = 0 end percent_finished = doc_settings:readSetting("percent_finished") end -- smooth 2 decimal points (0.00) instead of 16 decimal numbers - item.sort_percent = item.sort_percent or math.floor((percent_finished or -1) * 100) / 100 + item.sort_percent = sort_percent or math.floor((percent_finished or -1) * 100) / 100 item.percent_finished = percent_finished or 0 end, mandatory_func = function(item)