diff --git a/src/libs/convert/diffLocation.js b/src/libs/convert/diffLocation.js index 16441ca7209987bdf941634fd39a3660a083c59d..aadc9cf6fd341dc51214c58682b8ded5e371a055 100644 --- a/src/libs/convert/diffLocation.js +++ b/src/libs/convert/diffLocation.js @@ -30,5 +30,7 @@ module.exports = function location(id) { return 'Área remanescente de quilombos'; case 8: return 'Área onde se localizam povos e comunidades tradicionais'; + default: + return 'Não definido'; } }; diff --git a/src/libs/convert/specialEducationEntity.js b/src/libs/convert/specialEducationEntity.js new file mode 100644 index 0000000000000000000000000000000000000000..b358c4edaba32b3c18220a73279a74568aa59a97 --- /dev/null +++ b/src/libs/convert/specialEducationEntity.js @@ -0,0 +1,31 @@ +/* +Copyright (C) 2022 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of simcaq-node. + +simcaq-node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +simcaq-node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. +*/ + +module.exports = function specialEducation(id) { + switch (id) { + case 1: + return 'Classe Comum'; + case 2: + return 'Classe Exclusiva'; + default: + return 'Não definido'; + } +}; + diff --git a/src/libs/middlewares/aggregateData.js b/src/libs/middlewares/aggregateData.js index 3dadee22817dbf8d21fdf5307cf39ab71b464a18..aaa1ede48ce37f977f11e45b38e5dd87d4f8f5e6 100644 --- a/src/libs/middlewares/aggregateData.js +++ b/src/libs/middlewares/aggregateData.js @@ -22,6 +22,7 @@ const convert = { modality_integral_time: 'educationLevelBasic', special_education: 'specialEducation', special_education_doc: 'specialEducationDoc', + special_education_entity: 'specialEducationEntity', education_level_mod_doc: 'educationLevelModDoc', education_level_mod_entity_seg: 'educationLevelModEntitySeg', education_level_mod_entity_agg: 'educationLevelModEntityAgg', @@ -48,6 +49,7 @@ function aggregateData(req, res, next) { 'modality_integral_time', 'special_education', 'special_education_doc', + 'special_education_entity', 'education_level_mod_entity_seg', 'education_level_mod_entity_agg', 'adm_dependency_entity_agg', diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index 08a1ebed376c7267befd104587257e533674b843..078df393ba871ad00ad9d39baa1e5d4d3282aa21 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -118,6 +118,7 @@ const incomeRange = require(`${libs}/convert/incomeRange`); const ageRangeAggregate = require(`${libs}/convert/ageRangeAggregate`); const specialEducation = require(`${libs}/convert/specialEducation`); const specialEducationDoc = require(`${libs}/convert/specialEducationDoc`); +const specialEducationEntity = require(`${libs}/convert/specialEducationEntity`); const educationLevelModDoc = require(`${libs}/convert/educationLevelModDoc`); const educationLevelModEntitySeg = require(`${libs}/convert/educationLevelModEntitySeg`); const educationLevelModEntityAgg = require(`${libs}/convert/educationLevelModEntityAgg`); @@ -238,7 +239,8 @@ const ids = { education_level_mod_entity_seg: educationLevelModEntitySeg, education_level_mod_entity_agg: educationLevelModEntityAgg, age_range_entity: ageRangeEntity, - post_graduation_entity: postGraduationEntity + post_graduation_entity: postGraduationEntity, + special_education_entity: specialEducationEntity }; function transform(removeId=false) { @@ -376,5 +378,6 @@ module.exports = { educationLevelModEntitySeg, educationLevelModEntityAgg, ageRangeEntity, - postGraduationEntity + postGraduationEntity, + specialEducationEntity }; diff --git a/src/libs/routes_v1/enrollmentAggregate.js b/src/libs/routes_v1/enrollmentAggregate.js index d266d2403c00b742c3329fc871d863b9cf986842..08d55ddba8787ba9906a722ab2d6ca98e011e58f 100644 --- a/src/libs/routes_v1/enrollmentAggregate.js +++ b/src/libs/routes_v1/enrollmentAggregate.js @@ -114,7 +114,7 @@ enrollmentAggregateApp.get('/location', (req, res, next) => { enrollmentAggregateApp.get('/diff_location', (req, res, next) => { req.result = [] - for (let i = 0; i <= 4; i++) { + for (let i = 0; i < 4; i++) { req.result.push({ id: i, name: id2str.diffLocation(i) }); @@ -587,7 +587,7 @@ enrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { .field('SUM(escola.qt_mat_bas)', 'total') .field('escola.ano_censo', 'year') .group('escola.ano_censo') - .order('escola.ano_censo'); + .order('escola.ano_censo') } next(); }, query, aggregateData, id2str.transform(false), response('enrollment_aggregate')); diff --git a/src/libs/routes_v1/federativeEntity.js b/src/libs/routes_v1/federativeEntity.js index 4a356247ed93a439d349279d869cb1b67fc6570f..0b0c2b5c8230709ed81bbbddfb7fbd38dfc73d11 100644 --- a/src/libs/routes_v1/federativeEntity.js +++ b/src/libs/routes_v1/federativeEntity.js @@ -212,17 +212,17 @@ federativeEntityApp.get('/state', (req, res, next) => { next(); }, response('state')); -federativeEntityApp.get('/special_education', (req, res, next) => { +federativeEntityApp.get('/special_education_entity', (req, res, next) => { req.result = [] for (let i = 1; i <= 2; i++) { req.result.push({ - id: i, name: id2str.specialEducation(i) + id: i, name: id2str.specialEducationEntity(i) }); } next(); -}, response('special_education')); +}, response('special_education_entity')); rqf.addField({ @@ -467,7 +467,7 @@ federativeEntityApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { .order('docentes_sinopse.ano_censo') .where('docentes_sinopse.cod_reg = 0'); } - else if (req.query.dims && req.query.dims.includes('special_education')) + else if (req.query.dims && req.query.dims.includes('special_education_entity')) { req.sql.from('docentes_sinopse') .field('SUM(docentes_sinopse.num_doc_ed_especial_classe_comum)', 'total_doc_ed_especial_classe_comum')