fix(tracker): name and group quests built from partial records
Quests assembled from a Learner entry or a questDataOverrides entry that never captured every field reach the tracker with nil fields, since GetQuest copies rawdata key by key. Two of those show: a nil name printed as the quest id, and a nil zoneOrSort that sent _GetZoneName down its very first line, `if not zoneOrSort then return "Unknown Zone" end`, before it could consult the quest log header the earlier fix added. Those objects are cached for the session, so neither repaired itself. GetQuest now fills a missing name from the quest log and defaults zoneOrSort to 0, the value every caller already reads as "no zone on file" -- and which some of them require, `quest.zoneOrSort > 0` erroring outright on nil. _GetZoneName treats nil the same way rather than short-circuiting, which also stops a nil quest from labelling its group Unknown Zone under the sort modes that do not group by zone at all. The tracker asks the quest log for a title before printing an id, so quests already cached without a name come out right too, and the live-fallback builder stops discarding the override data it just looked up.
This commit is contained in:
@@ -63,6 +63,22 @@ local function GetWrappedWidth(label)
|
||||
return label:GetWidth()
|
||||
end
|
||||
|
||||
-- A quest built from partial data can reach the tracker with no name, or with the id standing in
|
||||
-- for one, and it is cached that way for the session. Ask the quest log before printing a number.
|
||||
local function GetDisplayableQuestName(quest)
|
||||
local questName = quest.name
|
||||
|
||||
if (not questName) or questName == "" or questName == tostring(quest.Id) then
|
||||
questName = TrackerUtils:GetQuestLogTitleById(quest.Id) or questName
|
||||
end
|
||||
|
||||
if (not questName) or questName == "" then
|
||||
questName = tostring(quest.Id)
|
||||
end
|
||||
|
||||
return questName
|
||||
end
|
||||
|
||||
local LSM30 = LibStub and LibStub("LibSharedMedia-3.0", true)
|
||||
|
||||
-- Local Vars
|
||||
@@ -1031,7 +1047,7 @@ function QuestieTracker:Update()
|
||||
|
||||
if quest.isFallback or quest._isLogFallback then
|
||||
-- Quest not in DB: use the name stored on the fallback object
|
||||
local questName = quest.name or tostring(quest.Id)
|
||||
local questName = GetDisplayableQuestName(quest)
|
||||
if Questie.db.profile.trackerShowQuestLevel and quest.level and quest.level > 0 then
|
||||
questName = "[" .. quest.level .. "] " .. questName
|
||||
end
|
||||
@@ -1065,7 +1081,7 @@ function QuestieTracker:Update()
|
||||
-- which queries the static DB only: for a quest with no DB entry it
|
||||
-- silently defaults to level 1, and Ascension's scaling then scales
|
||||
-- that wrong base instead of the quest's real level.
|
||||
local fallbackName = quest.name or tostring(quest.Id)
|
||||
local fallbackName = GetDisplayableQuestName(quest)
|
||||
if Questie.db.profile.trackerShowQuestLevel and quest.level and quest.level > 0 then
|
||||
fallbackName = QuestieLib:GetQuestString(quest.Id, fallbackName, quest.level, false)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user