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:
2026-08-17 15:57:17 +02:00
parent 26a135a2ca
commit 30fe4b83a9
3 changed files with 84 additions and 8 deletions
+23 -1
View File
@@ -809,7 +809,13 @@ local function _GetZoneName(zoneOrSort, questId, zoneNameOverride)
if zoneNameOverride and zoneNameOverride ~= "" then
return zoneNameOverride
end
if not zoneOrSort then return "Unknown Zone" end
-- A quest assembled from a partial record -- a Learner entry that never captured the field,
-- an override carrying a single key -- reaches here with no zoneOrSort at all. That is the
-- same "nothing to look up" case as 0, and the quest log below still knows where the client
-- files the quest, so it must not short-circuit to Unknown Zone ahead of that.
zoneOrSort = zoneOrSort or 0
local zoneName
local sortObj = Questie.db.profile.trackerSortObjectives
if sortObj == "byZone" or sortObj == "byZoneComplete" or sortObj == "byZoneCompleteReversed" or sortObj == "byZonePlayerProximity" or sortObj == "byZonePlayerProximityReversed" then
@@ -865,6 +871,22 @@ local function _GetZoneName(zoneOrSort, questId, zoneNameOverride)
return zoneName
end
-- The client's own title for a quest, or nil if the player does not have it. Quest objects can
-- reach the tracker without a usable name -- a questDataOverrides entry that carries no name
-- field, a QuestLogCache row read before the client had filled the title in -- and since those
-- objects are cached for the session, the name never repairs itself. The log always knows.
function TrackerUtils:GetQuestLogTitleById(questId)
local questLogIndex = GetQuestLogIndexForQuest(questId)
if not questLogIndex then return nil end
local title = GetQuestLogTitle(questLogIndex)
if title and title ~= "" then
return title
end
return nil
end
-- IsComplete must be a method (called as quest:IsComplete()), and it reads the state the last
-- refresh stored rather than closing over the state at build time -- these quests outlive many
-- redraws, and a captured value would still claim the quest is unfinished after it is turned in.