From 9f69485faf597ff048d4f37eb2ff2dfae71e07f1 Mon Sep 17 00:00:00 2001 From: Mickael Cagnion Date: Fri, 21 Aug 2026 08:20:30 +0200 Subject: [PATCH] Filter allocated nodes from unallocated power reports Keep Show Unallocated aligned with its label while preserving negative-power entries in Show Allocated. Extract this independent fix from the Weighted Score work because the bug already exists on the upstream base. Related issue 3810 covers a broader refresh problem and is not closed by this change. --- spec/System/TestPowerReport_spec.lua | 38 ++++++++++++++++++++++++++ src/Classes/PowerReportListControl.lua | 2 ++ 2 files changed, 40 insertions(+) create mode 100644 spec/System/TestPowerReport_spec.lua diff --git a/spec/System/TestPowerReport_spec.lua b/spec/System/TestPowerReport_spec.lua new file mode 100644 index 00000000000..a98126e5751 --- /dev/null +++ b/spec/System/TestPowerReport_spec.lua @@ -0,0 +1,38 @@ +describe("PowerReportListControl", function() + local PowerReportListControl + + before_each(function() + LoadModule("Classes/PowerReportListControl") + PowerReportListControl = common.classes.PowerReportListControl + end) + + local function relist(originalList, showClusters, allocated) + local control = { + originalList = originalList, + showClusters = showClusters or false, + allocated = allocated or false, + } + PowerReportListControl.ReList(control) + return control.list + end + + it("Show Unallocated excludes allocated nodes", function() + local list = relist({ + { name = "allocated", power = 10, pathDist = 1, allocated = true }, + { name = "unallocated", power = 5, pathDist = 1, allocated = false }, + }, false, false) + + assert.are.equal(1, #list) + assert.are.equal("unallocated", list[1].name) + end) + + it("Show Allocated includes allocated nodes", function() + local list = relist({ + { name = "allocated", power = -10, pathDist = 1, allocated = true }, + { name = "unallocated", power = 5, pathDist = 1, allocated = false }, + }, false, true) + + assert.are.equal(1, #list) + assert.are.equal("allocated", list[1].name) + end) +end) diff --git a/src/Classes/PowerReportListControl.lua b/src/Classes/PowerReportListControl.lua index 69738aac11f..6472b01eeb2 100644 --- a/src/Classes/PowerReportListControl.lua +++ b/src/Classes/PowerReportListControl.lua @@ -112,6 +112,8 @@ function PowerReportListClass:ReList() end if self.allocated then insert = item.allocated + elseif item.allocated then + insert = false end if not self.showMasteries and item.type == "Mastery" then insert = false