Skip to content

Commit

Permalink
Merge pull request #489 from adessoSE/fixStoryStatus
Browse files Browse the repository at this point in the history
Fix story status
  • Loading branch information
sMeilbeck authored Nov 2, 2023
2 parents 46adc04 + 10f0138 commit 1738494
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions backend/src/serverHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,17 @@ async function updateStoryTestStatus(storyId, storyLastTestStatus, scenarioStatu

async function updateScenarioTestStatus(uploadedReport) {
try {
await mongo.updateScenarioStatus(uploadedReport.storyId, uploadedReport.scenarioId, uploadedReport.status);
let storyStatus = uploadedReport.status;
if (uploadedReport.status === true) {
const scenarios = await mongo.getOneStory(uploadedReport.storyId).then((story) => story.scenarios);
const updateIndex = scenarios.findIndex((scen) => scen.scenario_id === uploadedReport.scenarioId);
console.log(scenarios, storyStatus, updateIndex, uploadedReport.scenarioId);
scenarios[updateIndex].lastTestPassed = uploadedReport.status;
storyStatus = scenarios.every((scen) => !!scen.lastTestPassed === true);
}
updateStoryTestStatus(uploadedReport.storyId, storyStatus, [{ scenarioId: uploadedReport.scenarioId, status: uploadedReport.status }]);
} catch (e) {
console.log('Could not Update Scenario LastTestPassed.');
console.log('Could not Update Scenario LastTestPassed.', e);
}
}

Expand Down

0 comments on commit 1738494

Please sign in to comment.