From 80566a63ef6d2d7880ddfb22dad32b8de8a2fc56 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 22 Jun 2026 12:59:02 +0530 Subject: [PATCH] GWM : calculation api validation --- app/controllers/calculation.controller.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/controllers/calculation.controller.js b/app/controllers/calculation.controller.js index 0110deb..18a975e 100644 --- a/app/controllers/calculation.controller.js +++ b/app/controllers/calculation.controller.js @@ -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);