fix(core): Fixes issue with workflow lastUpdated field (#5015)

Fixed issue causing workflow updated field to be affected by statistics data
This commit is contained in:
freya
2023-01-05 12:16:40 +00:00
committed by GitHub
parent 7954025eb2
commit 59004fe7bb
16 changed files with 263 additions and 28 deletions

View File

@@ -169,15 +169,17 @@ workflowStatsController.get(
// Get flag
const workflowId = req.params.id;
// Get the corresponding workflow
const workflow = await Db.collections.Workflow.findOne(workflowId);
// It will be valid if we reach this point, this is just for TS
if (!workflow) {
return { dataLoaded: false };
}
// Get the flag
const stats = await Db.collections.WorkflowStatistics.findOne({
select: ['latestEvent'],
where: {
workflowId,
name: StatisticsNames.dataLoaded,
},
});
const data: IWorkflowStatisticsDataLoaded = {
dataLoaded: workflow.dataLoaded,
dataLoaded: stats ? true : false,
};
return data;