diff --git a/app/controllers/calculation.controller.js b/app/controllers/calculation.controller.js index b91e62c..0110deb 100644 --- a/app/controllers/calculation.controller.js +++ b/app/controllers/calculation.controller.js @@ -128,6 +128,20 @@ exports.calculate_month = async (req, res) => { }); } + // 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 service = new IPICalculationService(dbConfig); const result = await service.runCompleteCalculation(year, quarter); await service.close();