Replace let with var in update.js

This commit is contained in:
Konstantinos Triantafyllou 2023-05-31 16:27:15 +03:00
parent 06be4d37ce
commit 273858cc2c
1 changed files with 13 additions and 12 deletions

View File

@ -385,10 +385,10 @@ function statsProfileOfIndicatorsAsVariable() {
function addFundingLevelInFilters(filter) {
if(filter.groupFilters && filter.groupFilters.length > 0) {
let index = filter.groupFilters.findIndex(filter => filter.field.includes('project'));
var index = filter.groupFilters.findIndex(filter => filter.field.includes('project'));
if(index !== -1) {
print('before: ' + JSON.stringify(filter));
let prefix = filter.groupFilters[index].field.substring(0, filter.groupFilters[index].field.indexOf('project'));
var prefix = filter.groupFilters[index].field.substring(0, filter.groupFilters[index].field.indexOf('project'));
if(!filter.groupFilters.find(filter => filter.field === prefix + "project.funding level 1")) {
filter.groupFilters.push({
"field": prefix + "project.funding level 1",
@ -409,22 +409,22 @@ function addFundingLevelInFilters(filter) {
function addFundingStreamInDefaultMSCA() {
print("addFundingStreamInDefaultMSCA")
let stakeholder = db.stakeholder.findOne({"alias": "default-fl1"});
var stakeholder = db.stakeholder.findOne({"alias": "default-fl1"});
if(stakeholder) {
stakeholder.topics.forEach((topic) => {
let topicObj = db.topic.findOne({"_id": ObjectId(topic)});
var topicObj = db.topic.findOne({"_id": ObjectId(topic)});
topicObj.categories.forEach((category) => {
let categoryObj = db.category.findOne({"_id": ObjectId(category)});
var categoryObj = db.category.findOne({"_id": ObjectId(category)});
categoryObj.subCategories.forEach((subCategory) => {
let subCategoryObj = db.subCategory.findOne({"_id": ObjectId(subCategory)});
var subCategoryObj = db.subCategory.findOne({"_id": ObjectId(subCategory)});
subCategoryObj.numbers.forEach((number) => {
let section = db.section.findOne({"_id": ObjectId(number)});
var section = db.section.findOne({"_id": ObjectId(number)});
section.indicators.forEach((indicator) => {
let indicatorObject = db.indicator.findOne({"_id": ObjectId(indicator)});
var indicatorObject = db.indicator.findOne({"_id": ObjectId(indicator)});
if(indicatorObject.indicatorPaths[0].parameters) {
indicatorObject.indicatorPaths[0].parameters['index_shortName'] = stakeholder.index_shortName.toLowerCase();
if(indicatorObject.indicatorPaths[0] && indicatorObject.indicatorPaths[0].chartObject) {
let json = JSON.parse(indicatorObject.indicatorPaths[0].chartObject);
var json = JSON.parse(indicatorObject.indicatorPaths[0].chartObject);
if(json.series && json.series.length > 0) {
json.series.forEach(query => {
if(query.query && query.query.filters && query.query.filters.length > 0) {
@ -441,11 +441,11 @@ function addFundingStreamInDefaultMSCA() {
});
});
subCategoryObj.charts.forEach((chart) => {
let section = db.section.findOne({"_id": ObjectId(chart)});
var section = db.section.findOne({"_id": ObjectId(chart)});
section.indicators.forEach((indicator) => {
let indicatorObject = db.indicator.findOne({"_id": ObjectId(indicator)});
var indicatorObject = db.indicator.findOne({"_id": ObjectId(indicator)});
if(indicatorObject.indicatorPaths[0] && indicatorObject.indicatorPaths[0].chartObject) {
let json = JSON.parse(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) {
@ -498,4 +498,5 @@ use monitordb;
// 11-04-2023
statsProfileOfIndicatorsAsVariable();
// 30-05-2023
addFundingStreamInDefaultMSCA();