fix category count #3
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
9220c37765
commit
bc58aacccc
1 changed files with 3 additions and 8 deletions
11
formatter.go
11
formatter.go
|
@ -1,7 +1,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
zordTree "g.arns.lt/zordsdavini/zord-tree"
|
zordTree "g.arns.lt/zordsdavini/zord-tree"
|
||||||
|
@ -18,7 +17,6 @@ func FormatTreeSummery(tree zordTree.Tree) Tree {
|
||||||
}
|
}
|
||||||
|
|
||||||
func readTree(tree zordTree.Tree, ts *Tree, isRoot bool) {
|
func readTree(tree zordTree.Tree, ts *Tree, isRoot bool) {
|
||||||
fmt.Println(ts.Categories, isRoot)
|
|
||||||
for _, subtree := range tree.Dirs {
|
for _, subtree := range tree.Dirs {
|
||||||
category := strings.Replace(subtree.Path, tree.Path, "", 1)
|
category := strings.Replace(subtree.Path, tree.Path, "", 1)
|
||||||
category = strings.Replace(category, "/", "", 1)
|
category = strings.Replace(category, "/", "", 1)
|
||||||
|
@ -28,12 +26,9 @@ func readTree(tree zordTree.Tree, ts *Tree, isRoot bool) {
|
||||||
}
|
}
|
||||||
ts.Categories[category] = int32(len(subtree.Files))
|
ts.Categories[category] = int32(len(subtree.Files))
|
||||||
} else {
|
} else {
|
||||||
if len(tree.Files) > 0 {
|
for _, subcategory := range subtree.Files[0].Category {
|
||||||
for _, subcategory := range tree.Files[0].Category {
|
if _, ok := ts.Categories[subcategory]; ok {
|
||||||
if val, ok := ts.Categories[subcategory]; ok {
|
ts.Categories[subcategory] += int32(len(subtree.Files))
|
||||||
fmt.Println(val, ok, subcategory)
|
|
||||||
ts.Categories[subcategory] += int32(len(subtree.Files))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue