schedule daily standup advisories
This commit is contained in:
@@ -23,6 +23,22 @@ type GitSync struct {
|
||||
Branch, Head, Status string `json:"branch" json:"head" json:"status"`
|
||||
}
|
||||
|
||||
type StandupItem struct {
|
||||
TaskID string `json:"task_id"`
|
||||
State domain.TaskState `json:"state"`
|
||||
Title string `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
func StandupItems(tasks []domain.Task) []StandupItem {
|
||||
out := make([]StandupItem, 0)
|
||||
for _, t := range tasks {
|
||||
if t.State == domain.StateQueued || t.State == domain.StateLeased || t.State == domain.StateBlocked {
|
||||
out = append(out, StandupItem{t.ID, t.State, t.Title})
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// BuildBrief folds only events in [from,to]. It is deliberately read-only.
|
||||
func BuildBrief(events []domain.Event, from, to time.Time, git GitSync) Brief {
|
||||
b := Brief{From: from, To: to, Quota: map[string]float64{}, Git: git}
|
||||
|
||||
@@ -94,6 +94,9 @@ func (s *Store) apply(e domain.Event) error {
|
||||
return err
|
||||
}
|
||||
t := s.tasks[e.TaskID]
|
||||
if e.Type == "QuotaReported" || e.Type == "StandupAdvisory" {
|
||||
return nil
|
||||
}
|
||||
switch e.Type {
|
||||
case "TaskCreated":
|
||||
if err := domain.ValidateCreated(p); err != nil {
|
||||
@@ -193,7 +196,8 @@ func (s *Store) Append(e domain.Event) error {
|
||||
return domain.ErrConflict
|
||||
}
|
||||
}
|
||||
if !taskExists && e.Type != "TaskCreated" {
|
||||
global := e.Type == "QuotaReported" || e.Type == "StandupAdvisory"
|
||||
if !taskExists && e.Type != "TaskCreated" && !global {
|
||||
return domain.ErrNotFound
|
||||
}
|
||||
if e.Type != "TaskCreated" && (e.Type == "TaskCompleted" || e.Type == "TaskBlocked" || e.Type == "TaskReleased") {
|
||||
|
||||
Reference in New Issue
Block a user