Retain processing evidence only for selected outputs
This commit is contained in:
@@ -121,3 +121,57 @@ func ExecutionRecoveries(counts ExecutionCounts) []RecoveryReason {
|
||||
}
|
||||
return reasons
|
||||
}
|
||||
|
||||
// WorkTotals retains the facts shared by the CLI summary and ordinary reports.
|
||||
type WorkTotals struct {
|
||||
Total int
|
||||
Started int
|
||||
Completed int
|
||||
WithErrors int
|
||||
Corrections int
|
||||
ModelOperations int
|
||||
ProposalResponses int
|
||||
Recoveries int
|
||||
FilteringResponses int
|
||||
}
|
||||
|
||||
func (t *WorkTotals) Record(state WorkState, operations []Operation) {
|
||||
if state != WorkNotStarted {
|
||||
t.Started++
|
||||
}
|
||||
if state == WorkCompleted {
|
||||
t.Completed++
|
||||
}
|
||||
hasError := false
|
||||
for _, operation := range operations {
|
||||
if operation.Reference.Kind != OperationValidationInput {
|
||||
t.ModelOperations++
|
||||
}
|
||||
if operation.Succeeded {
|
||||
if operation.Reference.Kind == OperationProposal {
|
||||
t.ProposalResponses++
|
||||
if len(operation.Filtered) > 0 {
|
||||
t.FilteringResponses++
|
||||
}
|
||||
}
|
||||
if len(operation.RecoveryReasons) > 0 {
|
||||
t.Recoveries++
|
||||
}
|
||||
}
|
||||
hasError = hasError || operation.FailureClass == FailureRecoverable
|
||||
}
|
||||
if hasError {
|
||||
t.WithErrors++
|
||||
}
|
||||
}
|
||||
|
||||
func (t *WorkTotals) Add(module WorkTotals) {
|
||||
t.Started += module.Started
|
||||
t.Completed += module.Completed
|
||||
t.WithErrors += module.WithErrors
|
||||
t.Corrections += module.Corrections
|
||||
t.ModelOperations += module.ModelOperations
|
||||
t.ProposalResponses += module.ProposalResponses
|
||||
t.Recoveries += module.Recoveries
|
||||
t.FilteringResponses += module.FilteringResponses
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user