Reuse validation facts when attributing skipped edits
This commit is contained in:
@@ -63,20 +63,18 @@ func (p *modulePipelineResult) rememberProposalRecovery(unit *WorkUnitOutcome) {
|
||||
func (p *modulePipelineResult) recordApplyFiltering(filters map[int][]outcomes.FilteredProposal, reports bool) {
|
||||
for pos, items := range filters {
|
||||
original := items[:0]
|
||||
var repairOperations map[int]*outcomes.Operation
|
||||
for _, item := range items {
|
||||
if _, repaired := p.revised[item.ProposalIndex]; !repaired {
|
||||
original = append(original, item)
|
||||
continue
|
||||
}
|
||||
if reports {
|
||||
operations := p.WorkUnits[pos].Operations
|
||||
for i := range operations {
|
||||
op := &operations[i]
|
||||
if op.Reference.Kind == outcomes.OperationCorrectionRepair && op.Reference.ProposalIndex != nil &&
|
||||
*op.Reference.ProposalIndex == item.ProposalIndex && slices.Contains(op.RecoveryReasons, outcomes.RecoveryCorrectionRevised) {
|
||||
mergeOperationFiltering(op, []outcomes.FilteredProposal{item})
|
||||
break
|
||||
}
|
||||
if repairOperations == nil {
|
||||
repairOperations = approvedRepairOperations(p.WorkUnits[pos].Operations)
|
||||
}
|
||||
if op := repairOperations[item.ProposalIndex]; op != nil {
|
||||
mergeOperationFiltering(op, []outcomes.FilteredProposal{item})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,3 +91,18 @@ func (p *modulePipelineResult) recordApplyFiltering(filters map[int][]outcomes.F
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func approvedRepairOperations(operations []outcomes.Operation) map[int]*outcomes.Operation {
|
||||
byProposal := make(map[int]*outcomes.Operation)
|
||||
for i := range operations {
|
||||
op := &operations[i]
|
||||
if op.Reference.Kind == outcomes.OperationCorrectionRepair && op.Reference.ProposalIndex != nil &&
|
||||
slices.Contains(op.RecoveryReasons, outcomes.RecoveryCorrectionRevised) {
|
||||
index := *op.Reference.ProposalIndex
|
||||
if byProposal[index] == nil {
|
||||
byProposal[index] = op
|
||||
}
|
||||
}
|
||||
}
|
||||
return byProposal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user