Expect avant-last line to be + echo grade

This commit is contained in:
nemunaire 2023-03-06 18:18:52 +01:00
parent 2129ba46ee
commit b1ad293810

View File

@ -80,12 +80,12 @@ func (r *Repository) fetchRepoTests(build_number int, steps map[string]float64)
continue continue
} }
if len(logs) < 1 { if len(logs) < 2 {
continue continue
} }
line := logs[len(logs)-1] line := logs[len(logs)-1]
if strings.HasPrefix(line.Message, "grade:") { if strings.HasPrefix(logs[len(logs)-2].Message, "+ echo grade:") && strings.HasPrefix(line.Message, "grade:") {
g, err := strconv.ParseFloat(strings.TrimSpace(strings.TrimPrefix(line.Message, "grade:")), 64) g, err := strconv.ParseFloat(strings.TrimSpace(strings.TrimPrefix(line.Message, "grade:")), 64)
if err == nil { if err == nil {
grade += g grade += g