Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion daemon/goa.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,10 @@ func (s *Server) goaLinesToSay() []goaLine {
case l.Task == "" || !s.goa.board.IsSettled(l.Task):
out = append(out, l)
case l.Report:
l.Text += goaSettledNote
// Once: a line GOA couldn't take comes back here with it said already.
if !strings.HasSuffix(l.Text, goaSettledNote) {
l.Text += goaSettledNote
}
out = append(out, l)
}
}
Expand Down
26 changes: 26 additions & 0 deletions daemon/goa_settled_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,29 @@ func TestGOAReportJoinedStaysAReport(t *testing.T) {
t.Fatalf("waiting: %+v", srv.goa.tell)
}
}

// A settled task's report GOA can't take yet goes back to wait, as goaFlush and
// goaTakeAtStop put it back, and still says its task is settled once when it goes.
func TestGOASettledNoteSaidOnce(t *testing.T) {
srv := startServer(t)
task, err := srv.goa.board.Add(proto.GOATask{Title: "settled", Session: "a-session", Status: proto.GOATaskWorking})
if err != nil {
t.Fatal(err)
}
if _, err := srv.goa.board.Update(task.ID, func(x *proto.GOATask) { x.Status = proto.GOATaskDone }); err != nil {
t.Fatal(err)
}
srv.goa.mu.Lock()
srv.goa.tell = []goaLine{{Text: "it reports done", Task: task.ID, Session: "a-session", Turn: goaLineReport, Report: true, Closed: true}}
srv.goa.mu.Unlock()
for range 3 {
lines := srv.goaLinesToSay()
srv.goa.mu.Lock()
srv.goa.tell = append(lines, srv.goa.tell...)
srv.goa.mu.Unlock()
}
got := srv.goaLinesToSay()
if len(got) != 1 || strings.Count(got[0].Text, goaSettledNote) != 1 {
t.Fatalf("after three returns: %+v", got)
}
}
Loading