feat(kæde): fanen Kæder og forslag i Kræver handling

This commit is contained in:
2026-09-30 13:59:25 +02:00
parent b389fa3564
commit f0b8df8ae3
10 changed files with 401 additions and 6 deletions
@@ -183,8 +183,18 @@ function SmartPickupFrame:addKpiRow(stats)
return row
end
-- Varepunkterne + kædens afgrødeforslag (ADChain.last; ingen evaluering her), samme loft MAX_ATTENTION.
function SmartPickupFrame:attentionFor(stats)
local attention = ADStorageStats.attentionList(stats, SmartPickupFrame.MAX_ATTENTION)
if ADChain == nil or ADChain.last == nil then return attention end
return ADStorageStats.mergeAttention(attention, ADStorageStats.chainEntries(ADChain.last), SmartPickupFrame.MAX_ATTENTION)
end
function SmartPickupFrame:alertText(entry)
local stat, fc, i18n = entry.stat, SmartPickupFrame.formatCompact, self.i18n
if entry.kind == "chainSuggest" then
return string.format(i18n:getText("spu_attention_chainSuggest"), entry.fieldId or 0, tostring(entry.from), tostring(entry.to))
end
if entry.kind == "empty" then
return string.format(i18n:getText("spu_alert_empty"), stat.title, self:formatDays(stat.days), fc(stat.farmLevel or 0), fc(math.abs(stat.net or 0)))
elseif entry.kind == "full" then
@@ -263,7 +273,7 @@ end
function SmartPickupFrame:fillItemOverview(adEnv, inventory, fullInventory)
local i18n = self.i18n
local stats = self:computeItemStats(adEnv, inventory, fullInventory)
local attention = ADStorageStats.attentionList(stats, SmartPickupFrame.MAX_ATTENTION)
local attention = self:attentionFor(stats)
self.itemView = {kpiRow = self:addKpiRow(stats), alertRows = {}, itemRows = {}, key = self:itemStructureKey(stats, attention)}
self.itemRebuildTicks = SmartPickupFrame.ITEM_REBUILD_TICKS
self:addTextRow(i18n:getText("spu_attention"))
@@ -307,7 +317,7 @@ function SmartPickupFrame:refreshItemOverview(adEnv, inventory, fullInventory)
local view = self.itemView
if view == nil then return end
local stats = self:computeItemStats(adEnv, inventory, fullInventory)
local attention = ADStorageStats.attentionList(stats, SmartPickupFrame.MAX_ATTENTION)
local attention = self:attentionFor(stats)
if self:itemStructureKey(stats, attention) ~= view.key then
self.itemRebuildTicks = (self.itemRebuildTicks or 0) - 1
if self.itemRebuildTicks <= 0 then self:requestRebuild() end