fix(kæde): højst 3 forslag pr. afgrøde og ét samlet kædepunkt i Kræver handling
This commit is contained in:
@@ -276,23 +276,18 @@ function ADStorageStats.rankAttention(list, max)
|
||||
return result
|
||||
end
|
||||
|
||||
-- "Kræver handling" fra kæden (ADChain.last): ét gult punkt pr. afgrødeforslag spilleren skal tage stilling til.
|
||||
-- Rangeres over "sælg nu" (score < 1000) og under røde punkter (>= 3000).
|
||||
ADStorageStats.CHAIN_SCORE = 1000
|
||||
-- "Kræver handling" fra kæden (ADChain.last): ÉT gult punkt "Kæde: N forslag" (klik -> fanen Kæder), så
|
||||
-- forslagene ikke fylder listen. Rangeres under alle røde punkter (>= 3000), øverst blandt de gule, over "sælg nu".
|
||||
ADStorageStats.CHAIN_SCORE = 2000
|
||||
|
||||
function ADStorageStats.chainEntries(last)
|
||||
local entries = {}
|
||||
local titles = last ~= nil and last.titles or {}
|
||||
local function title(name) return tostring((titles or {})[name] or name) end
|
||||
local count = 0
|
||||
for _, action in ipairs(last ~= nil and last.actions or {}) do
|
||||
if action.mode == "suggest" then
|
||||
local from = (action.from ~= nil and action.from ~= "") and title(action.from) or "-"
|
||||
table.insert(entries, {kind = "chainSuggest", level = "yellow", score = ADStorageStats.CHAIN_SCORE, fieldId = action.fieldId,
|
||||
from = from, to = title(action.to), hectares = action.hectares,
|
||||
text = string.format("F%s %s → %s", tostring(action.fieldId), from, title(action.to))})
|
||||
end
|
||||
if action.mode == "suggest" then count = count + 1 end
|
||||
end
|
||||
return entries
|
||||
if count == 0 then return {} end
|
||||
return {{kind = "chainSuggest", level = "yellow", score = ADStorageStats.CHAIN_SCORE, count = count,
|
||||
text = string.format("Kæde: %d", count)}}
|
||||
end
|
||||
|
||||
-- Varepunkterne (allerede rangeret) + kædens punkter, samme loft.
|
||||
|
||||
Reference in New Issue
Block a user