Skip to content
Snippets Groups Projects
Commit 7362acae authored by Fernando Erd's avatar Fernando Erd
Browse files

Merge branch 'homologa' into v1.15.7

parents 4f3cdd50 1c83bb00
No related branches found
No related tags found
1 merge request!272v1.15.7
Pipeline #24003 canceled
/*
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/>.
*/
module.exports = function initialTraining(id) {
switch (id) {
case 1:
return 'Sem formação mínima';
case 2:
return 'Ensino Médio na modalidade normal';
case 3:
return 'Superior bacharelado ou tecnólogo';
case 4:
return 'Superior com licenciatura ou complementação pedagógica';
}
};
/*
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/>.
*/
module.exports = function posTraining(id) {
switch (id) {
case 1:
return 'Sem pós-graduação';
case 2:
return 'Especialização';
case 3:
return 'Mestrado';
case 4:
return 'Doutorado';
}
};
......@@ -86,6 +86,8 @@ const arrangement = require(`${libs}/convert/arrangement`);
const nightTime = require(`${libs}/convert/nightTime`);
const discipline = require(`${libs}/convert/discipline`);
const finishUniversity = require(`${libs}/convert/finishUniversity`);
const initialTraining = require(`${libs}/convert/initialTraining`);
const posTraining = require(`${libs}/convert/posTraining`);
const ids = {
gender_id: gender,
......@@ -163,7 +165,9 @@ const ids = {
transport_id: transport,
arrangement_id: arrangement,
discipline: discipline,
finish_id: finishUniversity
finish_id: finishUniversity,
initial_training_id: initialTraining,
pos_training_id: posTraining
};
function transform(removeId=false) {
......@@ -268,5 +272,7 @@ module.exports = {
arrangement,
nightTime,
discipline,
finishUniversity
finishUniversity,
initialTraining,
posTraining
};
......@@ -126,6 +126,8 @@ const location = require(`${libs}/routes/location`);
const disciplines = require(`${libs}/routes/disciplines`);
const universityLocalOffer = require(`${libs}/routes/universityLocalOffer`);
api.get('/', (req, res) => {
res.json({ msg: 'SimCAQ API is running' });
});
......@@ -180,4 +182,5 @@ api.use('/mesoregion', mesoregion);
api.use('/microregion', microregion);
api.use('/location', location);
api.use('/disciplines', disciplines);
api.use('/universityLocalOffer', universityLocalOffer);
module.exports = api;
......@@ -479,13 +479,13 @@ disciplinesApp.get('/', rqf.parse(), (req, res, next) => {
.field('SUM(adequacao_lingua_portuguesa)', 'total_suitable_lingua_portuguesa')
.field('SUM(lingua_inglesa_not_null)', 'total_lingua_inglesa')
.field('SUM(adequacao_lingua_ingles)', 'total_suitable_lingua_inglesa')
.field('SUM(adequacao_lingua_inglesa)', 'total_suitable_lingua_inglesa')
.field('SUM(lingua_espanhola_not_null)', 'total_lingua_espanhola')
.field('SUM(adequacao_lingua_espanhol)', 'total_suitable_lingua_espanhola')
.field('SUM(adequacao_lingua_espanhola)', 'total_suitable_lingua_espanhola')
.field('SUM(lingua_francesa_not_null)', 'total_lingua_francesa')
.field('SUM(adequacao_lingua_frances)', 'total_suitable_lingua_francesa')
.field('SUM(adequacao_lingua_francesa)', 'total_suitable_lingua_francesa')
.field('SUM(lingua_outra_not_null)', 'total_lingua_outra')
.field('SUM(adequacao_lingua_outra)', 'total_suitable_lingua_outra')
......
......@@ -182,6 +182,28 @@ teacherApp.get('/ethnic_group', (req, res, next) => {
next();
}, response('ethnic_group'));
teacherApp.get('/initial_training', (req, res, next) => {
req.result = [];
for(let i = 1; i <=4; ++i) {
req.result.push({
id: i,
name: id2str.initialTraining(i)
});
}
next();
}, response('initial_training'));
teacherApp.get('/pos_training', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 4; ++i) {
req.result.push({
id: i,
name: id2str.posTraining(i)
});
}
next();
}, response('pos_training'));
rqf.addField({
name: 'filter',
field: false,
......@@ -432,6 +454,26 @@ rqf.addField({
type: 'integer',
field: 'cor_raca'
}
}).addValue({
name: 'initial_training',
table: 'docente',
tableField: 'formacao_inicial_docente',
resultField: 'initial_training_id',
where: {
relation: '=',
type: 'integer',
field: 'formacao_inicial_docente'
}
}).addValue({
name: 'pos_training',
table: 'docente',
tableField: 'formacao_pos_docente',
resultField: 'pos_training_id',
where: {
relation: '=',
type: 'integer',
field: 'formacao_pos_docente'
}
});
teacherApp.get('/', rqf.parse(), (req, res, next) => {
......
......@@ -373,6 +373,16 @@ rqf.addField({
type: 'integer',
field: 'cod_ies'
}
}).addValue({
name: 'universityLocalOffer',
table: '@',
tableField: ['cod_ies', 'nome_ies'],
resultField: ['university_id', 'university_name'],
where: {
relation: '=',
type: 'integer',
field: 'cod_ies'
}
}).addValue({
name:'upper_adm_dependency',
table: '@',
......@@ -641,7 +651,7 @@ rqf.addField({
universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => {
if ("localoffer" in req.dims) {
if ("university" in req.dims) {
if ("university" in req.dims || "universityLocalOffer" in req.dims) {
req.sql.from('localoferta_ens_superior_matricula')
.field('curso_ens_superior.ano_censo', 'year')
.field('COUNT(localoferta_ens_superior.cod_local_oferta)', 'total')
......@@ -668,7 +678,7 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => {
.field('localoferta_ens_superior_matricula.ano_censo', 'year')
.group('localoferta_ens_superior_matricula.ano_censo')
.order('localoferta_ens_superior_matricula.ano_censo')
} else if ("university" in req.dims) {
} else if ("university" in req.dims || "universityLocalOffer" in req.dims) {
req.sql.from('aluno_ens_superior')
.field('COUNT(*)', 'total')
.field("'Brasil'", 'name')
......@@ -680,14 +690,12 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => {
.order('aluno_ens_superior.cod_ies')
.order('aluno_ens_superior.ano_censo')
} else {
req.sql.from('aluno_ens_superior')
req.sql.from('localoferta_ens_superior_matricula')
.field('COUNT(*)', 'total')
.field("'Brasil'", 'name')
.field('aluno_ens_superior.ano_censo', 'year')
.where('aluno_ens_superior.cod_aluno_situacao = 2 OR aluno_ens_superior.cod_aluno_situacao = 6 OR aluno_ens_superior.matriculado = 1')
.where('aluno_ens_superior.cod_nivel_academico = 1')
.group('aluno_ens_superior.ano_censo')
.order('aluno_ens_superior.ano_censo')
.field('localoferta_ens_superior_matricula.ano_censo', 'year')
.group('localoferta_ens_superior_matricula.ano_censo')
.order('localoferta_ens_superior_matricula.ano_censo')
}
next();
}, rqf.build(), query, id2str.transform(), addMissing(rqf), response('universityEnrollment'));
......
''/*
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 universityLocalOfferApp = express.Router();
const libs = `${process.cwd()}/libs`;
const log = require(`${libs}/log`)(module);
const squel = require('squel');
const query = require(`${libs}/middlewares/query`).query;
const response = require(`${libs}/middlewares/response`);
const id2str = require(`${libs}/middlewares/id2str`);
const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`);
const request = require(`request`);
const config = require(`${libs}/config`);
const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
const addMissing = require(`${libs}/middlewares/addMissing`);
let rqf = new ReqQueryFields();
universityLocalOfferApp.use(cache('15 day'));
rqf.addField({
name: 'filter',
field: false,
where: true
}).addField({
name: 'dims',
field: true,
where: false
}).addValue({
name: 'city',
table: 'municipio',
tableField: ['nome', 'id'],
resultField: ['city_name', 'city_id'],
where: {
relation: '=',
type: 'integer',
field: 'cod_municipio',
table: 'localoferta_ens_superior'
},
join: {
primary: 'id',
foreign: 'cod_municipio',
foreignTable: 'localoferta_ens_superior'
}
}).addValue({
name: 'region',
table: 'regiao',
tableField: ['nome', 'id'],
resultField: ['region_name', 'region_id'],
where: {
relation: 'LIKE',
type: 'string',
field: 'id'
},
join: {
primary: 'nome',
foreign: 'nome_regiao_ies',
foreignTable: 'localoferta_ens_superior'
}
}).addValue({
name: 'min_year',
table: 'localoferta_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
table: 'localoferta_ens_superior',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'localoferta_ens_superior',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
table: 'localoferta_ens_superior',
field: 'ano_censo'
}
}).addValue({
name: 'state',
table: 'estado',
tableField: ['nome', 'id'],
resultField: ['state_name', 'state_id'],
where: {
relation: '=',
type: 'integer',
field: 'cod_uf',
table: 'localoferta_ens_superior'
},
join: {
primary: 'id',
foreign: 'cod_uf',
foreignTable: 'localoferta_ens_superior'
}
});
universityLocalOfferApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.from('localoferta_ens_superior')
.field('distinct localoferta_ens_superior.cod_ies', 'id')
.field('localoferta_ens_superior.ano_censo', 'year')
.field('ies_ens_superior.nome_ies', 'name')
.field('localoferta_ens_superior.cod_uf', 'state_id')
.field('localoferta_ens_superior.cod_municipio', 'city_id')
.field('localoferta_ens_superior.cod_regiao', 'region_id')
.join('ies_ens_superior', null, 'localoferta_ens_superior.cod_ies=ies_ens_superior.cod_ies AND localoferta_ens_superior.ano_censo=ies_ens_superior.ano_censo')
.where('localoferta_ens_superior.nome IS NOT NULL AND ies_ens_superior.nome_ies IS NOT NULL');
next();
}, query, response('universityLocalOfferApp'));
module.exports = universityLocalOfferApp;
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