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

Working

parent 9ba6c028
No related branches found
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...,!415Employees aggregate
...@@ -59,7 +59,7 @@ employeesAggregateApp.get('/years', (req, res, next) => { ...@@ -59,7 +59,7 @@ employeesAggregateApp.get('/years', (req, res, next) => {
employeesAggregateApp.get('/education_level_mod_doc', (req, res, next) => { employeesAggregateApp.get('/education_level_mod_doc', (req, res, next) => {
req.result = [] req.result = []
for (let i = 1; i <= 13; i++) { for (let i = 1; i <= 8; i++) {
req.result.push({ req.result.push({
id: i, name: id2str.educationLevelModDoc(i) id: i, name: id2str.educationLevelModDoc(i)
}); });
...@@ -67,31 +67,6 @@ employeesAggregateApp.get('/education_level_mod_doc', (req, res, next) => { ...@@ -67,31 +67,6 @@ employeesAggregateApp.get('/education_level_mod_doc', (req, res, next) => {
next(); next();
}, response('education_level_mod_doc')); }, response('education_level_mod_doc'));
employeesAggregateApp.get('/region', (req, res, next) => {
req.result = []
for (let i = 0; i <= 5; i++) {
req.result.push({
id: i, name: id2str.regionCode(i)
});
}
next();
}, response('period_agg'));
employeesAggregateApp.get('/state', (req, res, next) => {
req.result = []
for (let i = 11; i < 54; i++) {
if (id2str.stateName(i) !== 'Não declarada') {
req.result.push({
id: i, name: id2str.stateName(i)
});
}
}
next();
}, response('state'));
employeesAggregateApp.get('/special_education_doc', (req, res, next) => { employeesAggregateApp.get('/special_education_doc', (req, res, next) => {
req.result = [] req.result = []
...@@ -113,56 +88,6 @@ rqf.addField({ ...@@ -113,56 +88,6 @@ rqf.addField({
name: 'dims', name: 'dims',
field: true, field: true,
where: false where: false
}).addValue({
name: 'adm_dependency',
table: 'escola',
tableField: 'dependencia_adm_id',
resultField: 'adm_dependency_id',
where: {
relation: '=',
type: 'integer',
field: 'dependencia_adm_id'
}
}).addValue({
name: 'adm_dependency_detailed',
table: 'escola',
tableField: 'dependencia_adm_priv',
resultField: 'adm_dependency_detailed_id',
where: {
relation: '=',
type: 'integer',
field: 'dependencia_adm_priv'
}
}).addValue({
name: 'education_level_mod',
table: 'escola',
tableField: 'etapas_mod_ensino_segmento_id',
resultField: 'education_level_mod_id',
where: {
relation: '=',
type: 'integer',
field: 'etapas_mod_ensino_segmento_id'
}
}).addValue({
name:'integral_time',
table: 'escola',
tableField: 'tempo_integral',
resultField: 'integral_time_id',
where: {
relation: '=',
type: 'integer',
field: 'tempo_integral'
}
}).addValue({
name: 'education_level_short',
table: 'escola',
tableField: 'etapa_resumida',
resultField: 'education_level_short_id',
where: {
relation: '=',
type: 'integer',
field: 'etapa_resumida'
}
}).addValue({ }).addValue({
name: 'region', name: 'region',
table: 'regiao', table: 'regiao',
...@@ -345,36 +270,13 @@ rqf.addField({ ...@@ -345,36 +270,13 @@ rqf.addField({
foreign: ['escola_id', 'ano_censo'], foreign: ['escola_id', 'ano_censo'],
foreignTable: 'escola' foreignTable: 'escola'
} }
}, 'filter').addValue({ }, 'filter');
name: 'location',
table: 'escola',
tableField: 'localizacao_id',
resultField: 'location_id',
where: {
relation: '=',
type: 'integer',
field: 'localizacao_id'
}
}).addValue({
name: 'diff_location',
table: 'escola',
tableField: 'localizacao_diferenciada_par',
resultField: 'diff_location_id',
where: {
relation: '=',
type: 'integer',
field: 'localizacao_diferenciada_par'
}
});
// Return all cities // Return all cities
employeesAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { employeesAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
if (req.query.filter && !req.query.filter.includes('school')) if ((req.query.filter && !req.query.filter.includes('school')) || req.query.filter == undefined)
return; throw 'Filtro escola deve ser selecionado.';
if (req.query.filter == undefined)
return;
if (req.query.dims && req.query.dims.includes('education_level_mod_doc')) { if (req.query.dims && req.query.dims.includes('education_level_mod_doc')) {
req.sql.from('escola') req.sql.from('escola')
...@@ -409,6 +311,6 @@ employeesAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -409,6 +311,6 @@ employeesAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.where('escola.situacao_funcionamento_pareada = 1 and (escola.ensino_regular = 1 or escola.ensino_eja = 1 or escola.educacao_profissional = 1)'); .where('escola.situacao_funcionamento_pareada = 1 and (escola.ensino_regular = 1 or escola.ensino_eja = 1 or escola.educacao_profissional = 1)');
} }
next(); next();
}, query, aggregateData, id2str.transform(false), response('enrollment_aggregate')); }, query, aggregateData, id2str.transform(false), response('employees_aggregate'));
module.exports = employeesAggregateApp; module.exports = employeesAggregateApp;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment