Fix script for add funding stream in default msca
This commit is contained in:
parent
273858cc2c
commit
f246e4d6b8
29
update_db.js
29
update_db.js
|
@ -444,19 +444,22 @@ function addFundingStreamInDefaultMSCA() {
|
|||
var section = db.section.findOne({"_id": ObjectId(chart)});
|
||||
section.indicators.forEach((indicator) => {
|
||||
var indicatorObject = db.indicator.findOne({"_id": ObjectId(indicator)});
|
||||
if(indicatorObject.indicatorPaths[0] && indicatorObject.indicatorPaths[0].chartObject) {
|
||||
var json = JSON.parse(indicatorObject.indicatorPaths[0].chartObject);
|
||||
if(json.chartDescription && json.chartDescription.queries && json.chartDescription.queries.length > 0) {
|
||||
json.chartDescription.queries.forEach(query => {
|
||||
if(query.query && query.query.filters && query.query.filters.length > 0) {
|
||||
query.query.filters.forEach(filter => {
|
||||
filter = addFundingLevelInFilters(filter);
|
||||
})
|
||||
}
|
||||
});
|
||||
indicatorObject.indicatorPaths[0].chartObject = JSON.stringify(json);
|
||||
db.indicator.save(indicatorObject);
|
||||
}
|
||||
if(indicatorObject.indicatorPaths[0].parameters) {
|
||||
indicatorObject.indicatorPaths[0].parameters['index_shortName'] = stakeholder.index_shortName.toLowerCase();
|
||||
if (indicatorObject.indicatorPaths[0] && indicatorObject.indicatorPaths[0].chartObject) {
|
||||
var json = JSON.parse(indicatorObject.indicatorPaths[0].chartObject);
|
||||
if (json.chartDescription && json.chartDescription.queries && json.chartDescription.queries.length > 0) {
|
||||
json.chartDescription.queries.forEach(query => {
|
||||
if (query.query && query.query.filters && query.query.filters.length > 0) {
|
||||
query.query.filters.forEach(filter => {
|
||||
filter = addFundingLevelInFilters(filter);
|
||||
});
|
||||
}
|
||||
});
|
||||
indicatorObject.indicatorPaths[0].chartObject = JSON.stringify(json);
|
||||
db.indicator.save(indicatorObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue