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);
|
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) {
|
} catch (err) {
|
||||||
logger.error(err.message);
|
logger.error(err.message);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
// Auto-Fill Missing Quarterly Submissions Service
|
// Auto-Fill Missing Quarterly Submissions Service
|
||||||
const mysql = require('mysql2/promise');
|
const mysql = require('mysql2/promise');
|
||||||
|
const logger = require("../services/logger");
|
||||||
class AutoFillSubmissionService {
|
class AutoFillSubmissionService {
|
||||||
|
|
||||||
constructor(dbConfig) {
|
constructor(dbConfig) {
|
||||||
|
|||||||
@ -583,19 +583,20 @@ class IPICalculationService {
|
|||||||
await connection.query(
|
await connection.query(
|
||||||
`INSERT INTO manufacturing_ipi
|
`INSERT INTO manufacturing_ipi
|
||||||
(year, month, month_name, reference_date, total_weight,
|
(year, month, month_name, reference_date, total_weight,
|
||||||
weighted_index_sum, manufacturing_index, mom_change, yoy_change, status)
|
weighted_index_sum, manufacturing_index, mom_change, yoy_change, status, generated_on)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Completed')
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Completed',?)
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
total_weight=VALUES(total_weight),
|
total_weight=VALUES(total_weight),
|
||||||
weighted_index_sum=VALUES(weighted_index_sum),
|
weighted_index_sum=VALUES(weighted_index_sum),
|
||||||
manufacturing_index=VALUES(manufacturing_index),
|
manufacturing_index=VALUES(manufacturing_index),
|
||||||
mom_change=VALUES(mom_change),
|
mom_change=VALUES(mom_change),
|
||||||
yoy_change=VALUES(yoy_change),
|
yoy_change=VALUES(yoy_change),
|
||||||
status=VALUES(status)`,
|
status=VALUES(status),
|
||||||
|
generated_on = VALUES(generated_on)`,
|
||||||
[
|
[
|
||||||
year, month, monthNames[month], referenceDate,
|
year, month, monthNames[month], referenceDate,
|
||||||
ipiData.total_weight, ipiData.weighted_index_sum,
|
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