Skip to content

Commit

Permalink
Add done for check list
Browse files Browse the repository at this point in the history
  • Loading branch information
ddddddO committed Aug 23, 2021
1 parent fbea9c8 commit 2e38a5b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,36 +130,38 @@ func main() {
reviewDesign.Con(prepareInfra).Con(test)
test.Con(release).Con(finish)

g.Done(design, reviewDesign, developFeature2, finish)

if err := g.GenerateCheckList(design); err != nil {
panic(err)
}
}
```

```
- [ ] 設計
- [ ] レビュー対応
- [x] 設計
- [x] レビュー対応
- [ ] feature1開発
- [ ] レビュー対応
- [ ] feature2開発
- [x] feature2開発
- [ ] レビュー対応
- [ ] インフラ準備
- [ ] 結合テスト
- [ ] リリース
- [ ] finish
- [x] finish
```

2. share with members
- [ ] 設計
- [ ] レビュー対応
- [x] 設計
- [x] レビュー対応
- [ ] feature1開発
- [ ] レビュー対応
- [ ] feature2開発
- [x] feature2開発
- [ ] レビュー対応
- [ ] インフラ準備
- [ ] 結合テスト
- [ ] リリース
- [ ] finish
- [x] finish

# Reference
- [about DAG](https://nave-kazu.hatenablog.com/entry/2015/11/30/154810)
16 changes: 10 additions & 6 deletions gdag.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,35 +147,39 @@ func GenerateCheckList(n *Node) error {
sorted := sortComponentList(uniqAS)

out := ""
for _, v := range sorted {
out += fmt.Sprintf("- [ ] %s\n", v)
for _, node := range sorted {
if node.color == "#DarkGray" {
out += fmt.Sprintf("- [x] %s\n", node.text)
} else {
out += fmt.Sprintf("- [ ] %s\n", node.text)
}
}
fmt.Print(out)

return nil
}

var uniqAS = make(map[int]string)
var uniqAS = make(map[int]*Node)

func uniqAs(n *Node) {
if _, ok := uniqAS[n.as]; ok {
return
}
uniqAS[n.as] = n.text
uniqAS[n.as] = n

for _, d := range n.downstream {
uniqAs(d)
}
}

func sortComponentList(uniq map[int]string) []string {
func sortComponentList(uniq map[int]*Node) []*Node {
keys := make([]int, 0, len(uniq))
for k := range uniq {
keys = append(keys, k)
}
sort.Ints(keys)

sorted := make([]string, 0, len(keys))
sorted := make([]*Node, 0, len(keys))
for _, k := range keys {
v := uniq[k]
sorted = append(sorted, v)
Expand Down
10 changes: 6 additions & 4 deletions gdag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,20 @@ func ExampleGenerateCheckList() {
reviewDesign.Con(prepareInfra).Con(test)
test.Con(release).Con(finish)

g.Done(design, reviewDesign, developFeature2, finish)

if err := g.GenerateCheckList(design); err != nil {
panic(err)
}
// Output:
// - [ ] 設計
// - [ ] レビュー対応
// - [x] 設計
// - [x] レビュー対応
// - [ ] feature1開発
// - [ ] レビュー対応
// - [ ] feature2開発
// - [x] feature2開発
// - [ ] レビュー対応
// - [ ] インフラ準備
// - [ ] 結合テスト
// - [ ] リリース
// - [ ] finish
// - [x] finish
}

0 comments on commit 2e38a5b

Please sign in to comment.