undone reptasks dont count towards total in summary

This commit is contained in:
Dan Ballard 2018-05-10 11:31:12 -07:00
parent a7a60d1ed2
commit cbd04cef0a
2 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,8 @@ func (ph *processHandler) ProcessLine(line string, indentLevel int, stack []stri
return
}
if todo {
// inc count of todo items (rep tasks shouldnt count towards outstanding todo, unless done)
if todo && !repTask.Is {
ph.totalCount += 1
}
@ -52,10 +53,11 @@ func (ph *processHandler) ProcessLine(line string, indentLevel int, stack []stri
ph.headerPrinted = true
}
ph.doneCount += 1
// TODO: Math for [x] numXnum
repStr := ""
if repTask.Is {
repStr = strconv.Itoa( repTask.A * repTask.B)
// inc todo count here since we did a thing, its done, and we dont want a higher done count than total
ph.totalCount += 1
}
ph.Writeln("\t\t" + repStr + strings.Join(stack, " / "))
}

View File

@ -18,7 +18,7 @@ const EXPECTED = `
not nested
# Repetition
25 things
4 / 12
4 / 11
`
func TestSummary(t *testing.T) {
@ -55,6 +55,5 @@ func TestSummary(t *testing.T) {
errorStr := string(result[int(math.Max(0, float64(diffLoc - 10))) : int(math.Min(float64(len(result)), float64(diffLoc + 10))) ])
t.Errorf("Summary results do not match expected:\nfirst difference at line %v: '%v'\n%v<---->\n%v\n", line, errorStr, string(result), EXPECTED)
}
}