TASK SPRINT PLANNING 2
This commit is contained in:
@@ -48,6 +48,7 @@ func (t *SprintPlanningTask) Questions(interfaceType InterfaceType) Questions {
|
||||
return BaseQuestions(interfaceType).With(
|
||||
huh.NewGroup(
|
||||
huh.NewSelect[int]().
|
||||
Key("sprint-planning-selected-issues").
|
||||
Title("How many issues did you select for the sprint?").
|
||||
Options(
|
||||
huh.NewOption("2-3 issues", 1),
|
||||
@@ -58,6 +59,10 @@ func (t *SprintPlanningTask) Questions(interfaceType InterfaceType) Questions {
|
||||
)
|
||||
}
|
||||
|
||||
func (t *SprintPlanningTask) QuestionnaireKeys(_ InterfaceType) []string {
|
||||
return []string{"task_completed", "task_difficulty", "sprint-planning-selected-issues"}
|
||||
}
|
||||
|
||||
func (t *SprintPlanningTask) Setup(ctx context.Context) error {
|
||||
if err := ClearIssues(t.app); err != nil {
|
||||
return err
|
||||
@@ -116,6 +121,50 @@ func (t *SprintPlanningTask) Setup(ctx context.Context) error {
|
||||
func (t *SprintPlanningTask) Validate(ctx context.Context) ValidationFeedback {
|
||||
expect := check.NewExpector()
|
||||
|
||||
return expect.Complete()
|
||||
issues, err := FetchIssues(ctx, t.app, t.setupIssue)
|
||||
if err != nil {
|
||||
return expect.ValidationFeedback
|
||||
}
|
||||
|
||||
if len(issues) == 0 {
|
||||
expect.Fail("No backlog issues found to plan a sprint with.")
|
||||
return expect.ValidationFeedback
|
||||
}
|
||||
|
||||
// Sort by priority ascending (0 is highest priority).
|
||||
sorted := make([]*models.Issue, len(issues))
|
||||
copy(sorted, issues)
|
||||
for i := 0; i < len(sorted); i++ {
|
||||
for j := i + 1; j < len(sorted); j++ {
|
||||
if sorted[j].Priority < sorted[i].Priority {
|
||||
sorted[i], sorted[j] = sorted[j], sorted[i]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
topN := 5
|
||||
if len(sorted) < topN {
|
||||
topN = len(sorted)
|
||||
}
|
||||
top := sorted[:topN]
|
||||
|
||||
var plannedCount int
|
||||
var readyToSprintCount int
|
||||
for _, issue := range top {
|
||||
if issue.Status == models.StatusReadyToSprint ||
|
||||
issue.Status == models.StatusInProgress ||
|
||||
issue.Status == models.StatusClosed {
|
||||
plannedCount++
|
||||
}
|
||||
if issue.Status == models.StatusReadyToSprint {
|
||||
readyToSprintCount++
|
||||
}
|
||||
}
|
||||
|
||||
expect.Assert(plannedCount >= 3,
|
||||
"Expected at least 3 of the 5 highest-priority issues to be moved into 'ready_to_sprint', 'in_progress', or 'closed' for the sprint.")
|
||||
expect.Assert(readyToSprintCount >= 1,
|
||||
"Expected at least one of the highest-priority issues to be marked as 'ready_to_sprint' to indicate it is planned for the sprint.")
|
||||
|
||||
return expect.Complete()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user