From 4845023949d3e1fb7fd5a855207cfd9e4a131a6e Mon Sep 17 00:00:00 2001 From: Leszek Grzanka Date: Fri, 3 Jan 2025 18:01:04 +0100 Subject: [PATCH] Fix results label in simulation Related to #1927 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/yaptide/ui/issues/1927?shareId=XXXX-XXXX-XXXX-XXXX). --- src/services/ShSimulatorService.tsx | 31 ++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/services/ShSimulatorService.tsx b/src/services/ShSimulatorService.tsx index 221ec869..2ee23c78 100644 --- a/src/services/ShSimulatorService.tsx +++ b/src/services/ShSimulatorService.tsx @@ -410,17 +410,30 @@ const ShSimulation = ({ children }: GenericContextProviderProps) => { const jobInputs = await getJobInputs(info, signal, cache); - const refsInResults = - jobInputs?.input.inputJson && - recreateRefsInResults(jobInputs.input.inputJson, estimator); + if (jobInputs?.input.inputJson) { + const inputJsonForThisEstimator = { ...jobInputs.input.inputJson }; + inputJsonForThisEstimator.scoringManager.outputs = inputJsonForThisEstimator.scoringManager.outputs.filter( + output => output.name === estimatorName + ); - const data: SpecificEstimator = { - jobId, - estimators: refsInResults ?? estimator, - message: response.message - }; + const refsInResults = recreateRefsInResults(inputJsonForThisEstimator, estimator); - resolve(data); + const data: SpecificEstimator = { + jobId, + estimators: refsInResults ?? estimator, + message: response.message + }; + + resolve(data); + } else { + const data: SpecificEstimator = { + jobId, + estimators: estimator, + message: response.message + }; + + resolve(data); + } }, cacheKey, beforeCacheWrite