Attestations fix - shouldn't display instances if run removed
#CTCTOWALTZ-1469
@@ -35,12 +35,13 @@ const bindings = {
function mkAttestationData(attestationRuns = [], attestationInstances = []){
const runsById = _.keyBy(attestationRuns, "id");
- const runsAndInstances = _.map(attestationInstances, instance => ({
+ return _.chain(attestationInstances)
+ .filter(instance => !_.isEmpty(runsById[instance.attestationRunId]))
+ .map(instance => { return {
"instance": instance,
"run": runsById[instance.attestationRunId]
- }));
-
- return _.filter(runsAndInstances, attestation => !_.isEmpty(attestation.run));
+ }})
+ .value();
}
