| 1 | package taskplan |
| 2 | |
| 3 | type Kind string |
| 4 | |
| 5 | const ( |
| 6 | Bug Kind = "bug" |
| 7 | Feature Kind = "feature" |
| 8 | RenderedChange Kind = "rendered_change" |
| 9 | Recommendation Kind = "recommendation" |
| 10 | Investigation Kind = "investigation" |
| 11 | MaxSteps = 16 |
| 12 | ) |
| 13 | |
| 14 | type Step struct { |
| 15 | Key, Specialist, Action, Instructions string |
| 16 | ConnectionID, Model, SelectionReason string |
| 17 | Required bool |
| 18 | DependsOn []string |
| 19 | } |
| 20 | type Plan struct { |
| 21 | TaskID string |
| 22 | Revision int64 |
| 23 | Kind Kind |
| 24 | ProjectID int64 |
| 25 | Steps []Step |
| 26 | PlaybookID string |
| 27 | PlaybookRevision int64 |
| 28 | } |
| 29 | |
| 30 | func BugPlan(id string, project int64) Plan { |
| 31 | return Plan{TaskID: id, Revision: 1, Kind: Bug, ProjectID: project, Steps: []Step{ |
| 32 | {Key: "reproduce", Specialist: "engineering", Action: "reproduce"}, |
| 33 | {Key: "implement", Specialist: "engineering", Action: "implement"}, |
| 34 | {Key: "review", Specialist: "review", Action: "review", Required: true}, |
| 35 | {Key: "verify", Action: "checks", Required: true}, |
| 36 | {Key: "publish", Action: "publish"}, |
| 37 | {Key: "merge", Action: "person", Required: true}, |
| 38 | }} |
| 39 | } |
| 40 | func Publication(k Kind) bool { return k == Bug || k == Feature || k == RenderedChange } |
| 41 | func Candidate(s Step) bool { |
| 42 | return s.Action == "implement" || s.Action == "copy" || s.Action == "design" |
| 43 | } |
| 44 | |