From c1089c349f4428834d2fa103967aba1b112f3b7e Mon Sep 17 00:00:00 2001 From: Frederik Baerentsen Date: Sun, 28 Sep 2025 08:59:10 +0200 Subject: [PATCH] Fixed total minifigures for consolidated sets --- CHANGELOG.md | 4 ++++ bricktracker/sql/set/list/consolidated.sql | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b420a..cc51561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,10 @@ - Improved theme filtering: handles duplicate theme names correctly - Fixed set number sorting: proper numeric sorting in both ascending and descending order - Mixed status indicators for consolidated sets: three-state checkboxes (unchecked/partial/checked) with count badges + - Enhanced SQL aggregation with `IFNULL(SUM())` for accurate count statistics + - Template logic handles three states: none (0/2), all (2/2), partial (1/2) with visual indicators + - Purple overlay styling for partial states, disabled checkboxes for read-only consolidated status display + - Individual sets maintain full interactive checkbox functionality ### 1.2.4 diff --git a/bricktracker/sql/set/list/consolidated.sql b/bricktracker/sql/set/list/consolidated.sql index 6a90548..f25a814 100644 --- a/bricktracker/sql/set/list/consolidated.sql +++ b/bricktracker/sql/set/list/consolidated.sql @@ -12,7 +12,7 @@ SELECT COUNT("bricktracker_sets"."id") AS "instance_count", IFNULL(SUM("problem_join"."total_missing"), 0) AS "total_missing", IFNULL(SUM("problem_join"."total_damaged"), 0) AS "total_damaged", - IFNULL(SUM("minifigures_join"."total"), 0) AS "total_minifigures", + IFNULL(MAX("minifigures_join"."total"), 0) AS "total_minifigures", -- Keep one representative instance for display purposes GROUP_CONCAT("bricktracker_sets"."id", '|') AS "instance_ids", REPLACE(GROUP_CONCAT(DISTINCT "bricktracker_sets"."storage"), ',', '|') AS "storage",