Survey Quarter Details added in submission view api : GWM
This commit is contained in:
parent
17d961db62
commit
11386954b0
@ -619,7 +619,13 @@ exports.viewSubmissionDetails = async (req, res) => {
|
||||
};
|
||||
});
|
||||
const quarter_periods = getQuarterPeriods(Number(plainData.year), plainData.quarter);
|
||||
res.status(200).json({ status: "success", data: plainData, quarter_periods });
|
||||
|
||||
const quarter_window = await QuarterlyWindowsConfiguration.findOne({
|
||||
attributes : ['survey_name','year','quarter','start_date','end_date','grace_periods_days'],
|
||||
where: { is_active: true , year, quarter }
|
||||
});
|
||||
|
||||
res.status(200).json({ status: "success", data: plainData, quarter_periods , quarter_window });
|
||||
|
||||
} catch (err) {
|
||||
logger.error(err.message);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
// Auto-Fill Missing Quarterly Submissions Service
|
||||
const mysql = require('mysql2/promise');
|
||||
|
||||
const logger = require("../services/logger");
|
||||
class AutoFillSubmissionService {
|
||||
|
||||
constructor(dbConfig) {
|
||||
|
||||
@ -583,19 +583,20 @@ class IPICalculationService {
|
||||
await connection.query(
|
||||
`INSERT INTO manufacturing_ipi
|
||||
(year, month, month_name, reference_date, total_weight,
|
||||
weighted_index_sum, manufacturing_index, mom_change, yoy_change, status)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Completed')
|
||||
weighted_index_sum, manufacturing_index, mom_change, yoy_change, status, generated_on)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Completed',?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
total_weight=VALUES(total_weight),
|
||||
weighted_index_sum=VALUES(weighted_index_sum),
|
||||
manufacturing_index=VALUES(manufacturing_index),
|
||||
mom_change=VALUES(mom_change),
|
||||
yoy_change=VALUES(yoy_change),
|
||||
status=VALUES(status)`,
|
||||
status=VALUES(status),
|
||||
generated_on = VALUES(generated_on)`,
|
||||
[
|
||||
year, month, monthNames[month], referenceDate,
|
||||
ipiData.total_weight, ipiData.weighted_index_sum,
|
||||
ipiData.manufacturing_index, momChange, yoyChange
|
||||
ipiData.manufacturing_index, momChange, yoyChange , new Date()
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user