From e57225d21068a66dedae0e16f6e96bb1b8b9bc53 Mon Sep 17 00:00:00 2001 From: yamelsenih Date: Sat, 21 Dec 2024 18:06:31 -0400 Subject: [PATCH] Fixed error with Report for one grouping --- .../org/spin/report_engine/data/ReportInfo.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/spin/report_engine/data/ReportInfo.java b/src/main/java/org/spin/report_engine/data/ReportInfo.java index 244dcdf..73cd4aa 100644 --- a/src/main/java/org/spin/report_engine/data/ReportInfo.java +++ b/src/main/java/org/spin/report_engine/data/ReportInfo.java @@ -335,12 +335,22 @@ private void processChildren(Row parent, int levelAsInt) { List children = parent.getChildren(); PrintFormatItem previosLevelGroup = groupLevels.get(levelAsInt - 1); PrintFormatItem levelGroup = groupLevels.get(levelAsInt); - if(levelGroup == null || previosLevelGroup == null) { + if((levelGroup == null && groupLevels.size() > 1) || previosLevelGroup == null) { return; } rows.stream().filter(row -> { - return row.getLevel() == levelGroup.getSortSequence() && compareRows(parent, row, levelAsInt); + if(levelGroup == null && row.getLevel() > parent.getLevel() && compareRows(parent, row, levelAsInt)) { + return true; + } + if(levelGroup != null && row.getLevel() == levelGroup.getSortSequence() && compareRows(parent, row, levelAsInt)) { + return true; + } + return false; }).forEach(row -> children.add(row)); + // No Recursive + if(groupLevels.size() == 1) { + return; + } int nextLevel = levelAsInt + 1; if(nextLevel < groupLevels.size()) { children.forEach(child -> processChildren(child, nextLevel));