Skip to content

Commit d187f92

Browse files
committed
Bugfix: total rows not always displayed for trees
1 parent aad00d3 commit d187f92

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ common sense styling.
88

99
Lein:
1010
```
11-
[org.clojars.mjdowney/excel-clj "1.1.0"]
11+
[org.clojars.mjdowney/excel-clj "1.1.1"]
1212
```
1313

1414
- [Getting Started](#getting-started)

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject org.clojars.mjdowney/excel-clj "1.1.0"
1+
(defproject org.clojars.mjdowney/excel-clj "1.1.1"
22
:description "Generate Excel documents & PDFs from Clojure data."
33
:url "https://github.com/matthewdowney/excel-clj"
44
:license {:name "Eclipse Public License"

src/excel_clj/tree.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@
163163
(mapv #(update % ::depth inc) children)
164164
;; And finally an aggregation if there are multiple header children
165165
;; or any leaf children
166-
(when (or (> (count (group-by :depth children)) 2) (not (::header? (first children))))
167-
[(merge {::depth 0 ::label "" ::total? true} (value node aggregate-with))]))
166+
(let [fchild (first children)
167+
siblings (get (group-by :depth children) (:depth fchild))]
168+
(when (or (>= (count siblings) 2) (not (::header? fchild)))
169+
[(merge {::depth 0 ::label "" ::total? true} (value node aggregate-with))])))
168170
;; A leaf just has its label & value attrs. The depth is inc'd by each
169171
;; parent back to the root, so it does not stay at 0.
170172
(merge {::depth 0 ::label (label node)} (value node aggregate-with))))

0 commit comments

Comments
 (0)