GWM : calculation api validation

This commit is contained in:
Gowtham M 2026-06-22 12:59:02 +05:30
parent 69b90eabd3
commit 80566a63ef

View File

@ -311,6 +311,20 @@ exports.survey_auto_submit_and_calculate = async (req, res) => {
return res.status(400).json({ success: false, message: validation.message });
}
// check if the year and quarter window created or not and start the calculation
const window = await QuarterlyWindowsConfiguration.findOne({
where: {
year: year,
quarter: quarter
}
});
if (!window) {
return res.status(400).json({
success: false,
message: 'Year and quarter window not created'
});
}
const autoSubmitResult = await runSurveyAutoSubmit(year, quarter);
const calculationResult = await runQuarterCalculation(year, quarter);