From 4748f34989338522d820236f7282f7e62900c4e8 Mon Sep 17 00:00:00 2001 From: lwolczynski Date: Tue, 17 Dec 2024 10:43:29 -0600 Subject: [PATCH] IWF-124: Add filtering for NewOutputCollector --- service/interpreter/outputCollector.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/service/interpreter/outputCollector.go b/service/interpreter/outputCollector.go index 10da70cd..daa3bd58 100644 --- a/service/interpreter/outputCollector.go +++ b/service/interpreter/outputCollector.go @@ -7,11 +7,22 @@ type OutputCollector struct { } func NewOutputCollector(initOutputs []iwfidl.StateCompletionOutput) *OutputCollector { + filteredOutputs := []iwfidl.StateCompletionOutput{} + if initOutputs == nil { - initOutputs = []iwfidl.StateCompletionOutput{} - } - return &OutputCollector{ - outputs: initOutputs, + return &OutputCollector{ + outputs: filteredOutputs, + } + } else { + for _, output := range initOutputs { + if output.CompletedStateOutput != nil { + filteredOutputs = append(filteredOutputs, output) + } + } + + return &OutputCollector{ + outputs: filteredOutputs, + } } }