Skip to content
Snippets Groups Projects
Commit c2ccc44a authored by lgtg20's avatar lgtg20
Browse files

Fix filters and names

parent 2bf3697a
Branches
No related tags found
3 merge requests!417[ADD] Indicator "Taxa de Atendimento Educacional" updated on production!,!416[ADD] Route almost ready, some tests needed. Comments added and filters that...,!413Fix filters and names
...@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License ...@@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/ */
module.exports = function especialEducation(id) { module.exports = function specialEducation(id) {
switch (id) { switch (id) {
case 1: case 1:
return 'Inclusiva'; return 'Inclusiva';
......
...@@ -20,13 +20,13 @@ const convert = { ...@@ -20,13 +20,13 @@ const convert = {
integral_time_agg: 'integralTime', integral_time_agg: 'integralTime',
period_agg: 'period', period_agg: 'period',
modality_integral_time: 'educationLevelBasic', modality_integral_time: 'educationLevelBasic',
especial_education: 'especialEducation' special_education: 'specialEducation'
} }
function aggregateData(req, res, next) { function aggregateData(req, res, next) {
if (req.query.dims) { if (req.query.dims) {
const newResult = [] const newResult = []
const aggregateFields = ['gender', 'age_range', 'ethnic_group', 'education_level_mod_agg', 'integral_time_agg', 'period_agg', 'modality_integral_time', 'especial_education'] const aggregateFields = ['gender', 'age_range', 'ethnic_group', 'education_level_mod_agg', 'integral_time_agg', 'period_agg', 'modality_integral_time', 'special_education']
let id; let id;
const fields = req.query.dims.split(','); const fields = req.query.dims.split(',');
let currentAggregateField; let currentAggregateField;
......
...@@ -116,7 +116,7 @@ const metroCode = require(`${libs}/convert/metroCode`); ...@@ -116,7 +116,7 @@ const metroCode = require(`${libs}/convert/metroCode`);
const modalityShift = require(`${libs}/convert/modalityShift`); const modalityShift = require(`${libs}/convert/modalityShift`);
const incomeRange = require(`${libs}/convert/incomeRange`); const incomeRange = require(`${libs}/convert/incomeRange`);
const ageRangeAggregate = require(`${libs}/convert/ageRangeAggregate`); const ageRangeAggregate = require(`${libs}/convert/ageRangeAggregate`);
const especialEducation = require(`${libs}/convert/especialEducation`); const specialEducation = require(`${libs}/convert/specialEducation`);
const ids = { const ids = {
gender_id: gender, gender_id: gender,
...@@ -226,7 +226,7 @@ const ids = { ...@@ -226,7 +226,7 @@ const ids = {
metro_code_id: metroCode, metro_code_id: metroCode,
modality_shift_id: modalityShift, modality_shift_id: modalityShift,
income_range_id: incomeRange, income_range_id: incomeRange,
especial_education: especialEducation special_education: specialEducation
}; };
function transform(removeId=false) { function transform(removeId=false) {
...@@ -358,5 +358,5 @@ module.exports = { ...@@ -358,5 +358,5 @@ module.exports = {
metroCode, metroCode,
modalityShift, modalityShift,
incomeRange, incomeRange,
especialEducation specialEducation
}; };
...@@ -78,7 +78,7 @@ enrollmentAggregateApp.get('/adm_dependency_detailed', (req, res, next) => { ...@@ -78,7 +78,7 @@ enrollmentAggregateApp.get('/adm_dependency_detailed', (req, res, next) => {
next(); next();
}, response('adm_dependency_detailed')); }, response('adm_dependency_detailed'));
enrollmentAggregateApp.get('/education_level_mod', (req, res, next) => { enrollmentAggregateApp.get('/education_level_mod_agg', (req, res, next) => {
req.result = [] req.result = []
for (let i = 1; i <= 13; i++) { for (let i = 1; i <= 13; i++) {
...@@ -87,9 +87,9 @@ enrollmentAggregateApp.get('/education_level_mod', (req, res, next) => { ...@@ -87,9 +87,9 @@ enrollmentAggregateApp.get('/education_level_mod', (req, res, next) => {
}); });
} }
next(); next();
}, response('education_level_mod')); }, response('education_level_mod_agg'));
enrollmentAggregateApp.get('/integral_time', (req, res, next) => { enrollmentAggregateApp.get('/integral_time_agg', (req, res, next) => {
req.result = [] req.result = []
for (let i = 0; i <= 3; i++) { for (let i = 0; i <= 3; i++) {
...@@ -98,7 +98,7 @@ enrollmentAggregateApp.get('/integral_time', (req, res, next) => { ...@@ -98,7 +98,7 @@ enrollmentAggregateApp.get('/integral_time', (req, res, next) => {
}); });
} }
next(); next();
}, response('education_level_mod')); }, response('integral_time_agg'));
enrollmentAggregateApp.get('/location', (req, res, next) => { enrollmentAggregateApp.get('/location', (req, res, next) => {
req.result = [] req.result = []
...@@ -212,17 +212,17 @@ enrollmentAggregateApp.get('/state', (req, res, next) => { ...@@ -212,17 +212,17 @@ enrollmentAggregateApp.get('/state', (req, res, next) => {
next(); next();
}, response('state')); }, response('state'));
enrollmentAggregateApp.get('/especial_education', (req, res, next) => { enrollmentAggregateApp.get('/special_education', (req, res, next) => {
req.result = [] req.result = []
for (let i = 1; i <= 2; i++) { for (let i = 1; i <= 2; i++) {
req.result.push({ req.result.push({
id: i, name: id2str.especialEducation(i) id: i, name: id2str.specialEducation(i)
}); });
} }
next(); next();
}, response('especial_education')); }, response('special_education'));
rqf.addField({ rqf.addField({
...@@ -574,7 +574,7 @@ enrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -574,7 +574,7 @@ enrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.group('escola.ano_censo') .group('escola.ano_censo')
.order('escola.ano_censo') .order('escola.ano_censo')
} }
else if (req.query.dims && req.query.dims.includes('especial_education')) { else if (req.query.dims && req.query.dims.includes('special_education')) {
req.sql.from('escola') req.sql.from('escola')
.field('SUM(escola.qt_mat_esp_cc)', 'total_qt_mat_esp_cc') .field('SUM(escola.qt_mat_esp_cc)', 'total_qt_mat_esp_cc')
.field('SUM(escola.qt_mat_esp_ce)', 'total_qt_mat_esp_ce') .field('SUM(escola.qt_mat_esp_ce)', 'total_qt_mat_esp_ce')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment