rename variables to something more descriptive

This commit is contained in:
uturunku1 2022-01-04 16:39:43 -05:00 committed by Sebastian Rivera
parent 385589e1a4
commit a9da859ee5

View File

@ -19,31 +19,31 @@ type taskResultSummary struct {
type taskStageReadFunc func(b *Cloud, stopCtx context.Context) (*tfe.TaskStage, error) type taskStageReadFunc func(b *Cloud, stopCtx context.Context) (*tfe.TaskStage, error)
func summarizeTaskResults(taskResults []*tfe.TaskResult) *taskResultSummary { func summarizeTaskResults(taskResults []*tfe.TaskResult) *taskResultSummary {
var pe, er, erm, pa int var pendingCount, errCount, errMandatoryCount, passedCount int
for _, task := range taskResults { for _, task := range taskResults {
if task.Status == "unreachable" { if task.Status == "unreachable" {
return &taskResultSummary{ return &taskResultSummary{
unreachable: true, unreachable: true,
} }
} else if task.Status == "running" || task.Status == "pending" { } else if task.Status == "running" || task.Status == "pendingCountnding" {
pe++ pendingCount++
} else if task.Status == "passed" { } else if task.Status == "passed" {
pa++ passedCount++
} else { } else {
// Everything else is a failure // Everything else is a failure
er++ errCount++
if task.WorkspaceTaskEnforcementLevel == "mandatory" { if task.WorkspaceTaskEnforcementLevel == "mandatory" {
erm++ errMandatoryCount++
} }
} }
} }
return &taskResultSummary{ return &taskResultSummary{
unreachable: false, unreachable: false,
pending: pe, pending: pendingCount,
failed: er, failed: errCount,
failedMandatory: erm, failedMandatory: errMandatoryCount,
passed: pa, passed: passedCount,
} }
} }