Skip to content
Snippets Groups Projects
Commit 064a5651 authored by Vytor Calixto's avatar Vytor Calixto :space_invader:
Browse files

Merge branch 'hotfix_v1.0.3'

parents 696127e2 7baa6229
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## 1.0.3 - 2018-04-27
### Changed
- Fixed bug undefined field in some indicators
## 1.0.2 - 2018-04-18
### Changed
- Fixed bug in pibpercapita route
......
......@@ -5,7 +5,7 @@ module.exports = function addMissing(rqf){
if(dims.length != 2) return next();
if(req.filter.min_year != req.filter.max_year) return next();
if(req.result.length === 0) return next();
let result = req.result;
let dimsValues = {};
result.forEach((r) => {
......@@ -19,29 +19,29 @@ module.exports = function addMissing(rqf){
}
})
});
let G = {};
let rqfName = rqf.fieldValues[dims[0]].resultField;
let rqfName2 = rqf.fieldValues[dims[1]].resultField;
G[rqfName] = {};
dimsValues[rqfName].forEach((value) => {
let secondDim = {};
dimsValues[rqfName2].forEach((dValue) => {
secondDim[dValue] = false;
});
G[rqfName][value] = {};
G[rqfName][value][rqfName2] = secondDim;
});
result.forEach((r) => {
let resultDim1 = r[rqfName];
let resultDim2 = r[rqfName2];
G[rqfName][resultDim1][rqfName2][resultDim2] = true;
});
Object.keys(G[rqfName]).forEach((dim1Value) => {
Object.keys(G[rqfName][dim1Value][rqfName2]).forEach((dim2Value) => {
let value = G[rqfName][dim1Value][rqfName2][dim2Value];
......@@ -55,14 +55,16 @@ module.exports = function addMissing(rqf){
if(r[rqfName] > newEntry[rqfName]) break;
if(r[rqfName] == newEntry[rqfName] && r[rqfName2] > newEntry[rqfName2]) break;
}
let newResult = [...result.slice(0, index), newEntry, ...result.slice(index, result.length)];
result = newResult;
if (newEntry.dim1Value != undefined && newEntry.dim2Value != undefined) {
let newResult = [...result.slice(0, index), newEntry, ...result.slice(index, result.length)];
result = newResult;
}
}
});
});
req.result = result;
next();
};
};
\ No newline at end of file
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment