dashboard conflit resolved : GWM

This commit is contained in:
Gowtham M 2025-11-12 09:27:14 +05:30
parent c5ec47f201
commit bef081d417

View File

@ -189,21 +189,24 @@ exports.adminDashboard = async (req, res) => {
let { quarter, year } = req.query;
// if quarter/year not passed → take latest open config
if (!quarter || !year) {
const lastConfig = await QuarterlyWindowsConfiguration.findOne({
order: [
['year', 'DESC'],
['quarter', 'DESC']
]
});
// if (!quarter || !year) {
// const lastConfig = await QuarterlyWindowsConfiguration.findOne({
// order: [
// ['year', 'DESC'],
// ['quarter', 'DESC']
// ]
// });
if (lastConfig) {
quarter = lastConfig.quarter;
year = lastConfig.year;
}
}
// if (lastConfig) {
// quarter = lastConfig.quarter;
// year = lastConfig.year;
// }
// }
let whereCond = {};
if (quarter === 'All') quarter = null;
if (year === 'All') year = null;
const whereCond = {};
if (quarter) whereCond.quarter = quarter;
if (year) whereCond.year = year;