Skip to content
Snippets Groups Projects
Commit 7129f7c6 authored by Victor Picussa's avatar Victor Picussa
Browse files

[v1.13.0]Added class changes

parent 9d5adb86
No related branches found
No related tags found
2 merge requests!254WIP: v1.13.0,!253V1.13.0
Pipeline #23024 failed
......@@ -27,11 +27,15 @@ module.exports = function admDependencyPriv(id) {
case 3:
return 'Municipal';
case 4:
return 'Privada conveniada';
return 'Privada conveniada sem fins lucrativos';
case 5:
return 'Privada não conveniada sem fins lucrativos';
return 'Privada conveniada com fins lucrativos';
case 6:
return 'Privada não conveniada sem fins lucrativos';
case 7:
return 'Privada não conveniada com fins lucrativos';
case 8:
return 'Privada sem detalhamento';
default:
return 'Não classificada';
}
......
......@@ -78,6 +78,8 @@ const teacherSchooling = require(`${libs}/convert/teacherSchooling`);
const ethnicGroupTeacherIES = require(`${libs}/convert/ethnicGroupTeacherIES`);
const genderIES = require(`${libs}/convert/genderIES`);
const deficiency = require(`${libs}/convert/studentDeficiency`);
const govermentAgreement = require(`${libs}/convert/govermentAgreement`);
const arrangement = require(`${libs}/convert/arrangement`);
const ids = {
gender_id: gender,
......@@ -95,7 +97,7 @@ const ids = {
ethnic_group_id: ethnicGroup,
agreement_id: agreement,
integral_time_id: integralTime,
government_agreement_id: booleanVariable,
government_agreement_id: govermentAgreement,
education_day_care_child_id: booleanVariable,
education_preschool_child_id: booleanVariable,
education_begin_elementary_school_id: booleanVariable,
......@@ -149,7 +151,8 @@ const ids = {
gender_ies_id: genderIES,
deficiency_id: deficiency,
age_student_code_id: ageStudentCode,
transport_id: transport
transport_id: transport,
arrangement_id: arrangement
};
function transform(removeId=false) {
......@@ -246,5 +249,7 @@ module.exports = {
ethnicGroupTeacherIES,
genderIES,
deficiency,
transport
transport,
govermentAgreement,
arrangement
};
/*
Copyright (C) 2016 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/>.
*/
const express = require('express');
const classApp = express.Router();
......@@ -18,12 +38,8 @@ const id2str = require(`${libs}/middlewares/id2str`);
const config = require(`${libs}/config`);
const download = require(`${libs}/middlewares/downloadDatabase`);
const addMissing = require(`${libs}/middlewares/addMissing`);
const passport = require('passport');
const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
let rqfCount = new ReqQueryFields();
......@@ -70,7 +86,9 @@ classApp.get('/rural_location', (req, res, next) => {
{id: 3, name: "Rural - Área de assentamento"},
{id: 4, name: "Rural - Terra indígena"},
{id: 5, name: "Rural - Área remanescente de quilombos"},
{id: 6, name: "Rural - Unidade de uso sustentável"}
{id: 6, name: "Rural - Unidade de uso sustentável"},
{id: 7, name: "Unidade de uso sustentavel em terra indígena"},
{id: 8, name: "Unidade de uso sustentável em área remanescente de quilombos"}
];
next();
}, response('rural_location'));
......@@ -89,7 +107,7 @@ classApp.get('/adm_dependency', (req, res, next) => {
classApp.get('/adm_dependency_detailed', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 6; ++i) {
for(let i = 1; i <= 8; ++i) {
req.result.push({
id: i,
name: id2str.admDependencyPriv(i)
......@@ -107,10 +125,6 @@ classApp.get('/period', (req, res, next) => {
name: id2str.period(i)
});
}
req.result.push({
id: 99,
name: id2str.period(99)
});
next();
}, response('period'));
......@@ -133,10 +147,6 @@ classApp.get('/education_level_mod', (req, res, next) => {
name: id2str.educationLevelMod(i)
});
}
req.result.push({
id: 99,
name: id2str.educationLevelMod(99)
});
next();
}, response('education_level_mod'));
......@@ -197,8 +207,8 @@ rqfCount.addField({
}, 'filter').addValue({
name: 'state',
table: 'estado',
tableField: 'nome',
resultField: 'state_name',
tableField: ['nome', 'id'],
resultField: ['state_name', 'state_id'],
where: {
relation: '=',
type: 'integer',
......@@ -213,8 +223,8 @@ rqfCount.addField({
}).addValue({
name: 'region',
table: 'regiao',
tableField: 'nome',
resultField: 'region_name',
tableField: ['nome', 'id'],
resultField: ['region_name', 'region_id'],
where: {
relation: '=',
type: 'integer',
......@@ -322,7 +332,7 @@ rqfCount.addField({
resultField: 'integral_time_id',
where: {
relation: '=',
type: 'boolean',
type: 'integer',
field: 'tempo_integral'
}
}).addValueToField({
......@@ -358,17 +368,16 @@ rqfCount.addField({
}, 'filter');
classApp.get('/', rqfCount.parse(), rqfCount.build(), (req, res, next) => {
classApp.get('/', rqfCount.parse(), (req, res, next) => {
req.sql.field('COUNT(turma.id)', 'total')
.field("'Brasil'", 'name')
.field('turma.ano_censo', 'year')
.from('turma')
.group('turma.ano_censo')
.order('turma.ano_censo')
.where('turma.tipo_turma_id = 0 OR turma.tipo_turma_id = 1 OR turma.tipo_turma_id = 2 OR turma.tipo_turma_id = 3');
.where('(turma.tipo_turma_id >= 0 AND turma.tipo_turma_id <= 3 AND turma.tipo_atendimento_id is NULL) \
OR ((turma.tipo_atendimento_id = 1 OR turma.tipo_atendimento_id = 2) AND turma.tipo_turma_id is NULL) ');
next();
}, query, addMissing(rqfCount), id2str.transform(), response('class'));
classApp.get('/download', passport.authenticate('bearer', { session: false }), rqfCount.parse(), rqfCount.build(), download('turma', 'mapping_turma'));
}, rqfCount.build(), query, addMissing(rqfCount), id2str.transform(), response('class'));
module.exports = classApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment