Skip to content
Snippets Groups Projects
Commit f5442479 authored by Leon A. Okida Gonçalves's avatar Leon A. Okida Gonçalves
Browse files

add year field to new routes default queries

parent 6d6e2deb
No related branches found
No related tags found
4 merge requests!377prd_version of simcaq,!368update filter in v2 school,!354Development,!353V2 aggregated routes
...@@ -83,7 +83,7 @@ rqf.addField({ ...@@ -83,7 +83,7 @@ rqf.addField({
field: 'escola_id' field: 'escola_id'
} }
}).addValue({ }).addValue({
name: 'stage', name: 'education_level_short_id',
table: 'simcaq_diagnostico_de_matricula', table: 'simcaq_diagnostico_de_matricula',
tableField: 'etapa', tableField: 'etapa',
where: { where: {
...@@ -113,7 +113,7 @@ rqf.addField({ ...@@ -113,7 +113,7 @@ rqf.addField({
simcaqEnrollmentDiagnosisApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { simcaqEnrollmentDiagnosisApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.from('simcaq_diagnostico_de_matricula') req.sql.from('simcaq_diagnostico_de_matricula')
.field('simcaq_diagnostico_de_matricula.etapa', 'stage') .field('simcaq_diagnostico_de_matricula.etapa', 'education_level_short_id')
.field('SUM(simcaq_diagnostico_de_matricula.total)', 'total') .field('SUM(simcaq_diagnostico_de_matricula.total)', 'total')
.field('SUM(simcaq_diagnostico_de_matricula.matriculas_federal)', 'federal_enrollments') .field('SUM(simcaq_diagnostico_de_matricula.matriculas_federal)', 'federal_enrollments')
.field('SUM(simcaq_diagnostico_de_matricula.matriculas_estadual)', 'state_enrollments') .field('SUM(simcaq_diagnostico_de_matricula.matriculas_estadual)', 'state_enrollments')
...@@ -124,6 +124,8 @@ simcaqEnrollmentDiagnosisApp.get('/', rqf.parse(), rqf.build(), (req, res, next) ...@@ -124,6 +124,8 @@ simcaqEnrollmentDiagnosisApp.get('/', rqf.parse(), rqf.build(), (req, res, next)
.field('SUM(simcaq_diagnostico_de_matricula.matriculas_priv_nao_conv_com_fin)', 'private_not_affiliated_for_profit_enrollments') .field('SUM(simcaq_diagnostico_de_matricula.matriculas_priv_nao_conv_com_fin)', 'private_not_affiliated_for_profit_enrollments')
.field('SUM(simcaq_diagnostico_de_matricula.matriculas_urbana)', 'urban_enrollments') .field('SUM(simcaq_diagnostico_de_matricula.matriculas_urbana)', 'urban_enrollments')
.field('SUM(simcaq_diagnostico_de_matricula.matriculas_rural)', 'rural_enrollments') .field('SUM(simcaq_diagnostico_de_matricula.matriculas_rural)', 'rural_enrollments')
.field('ano_censo', 'year')
.group('ano_censo')
.group('simcaq_diagnostico_de_matricula.etapa'); .group('simcaq_diagnostico_de_matricula.etapa');
next(); next();
}, query, response('enrollmentDiagnosis')); }, query, response('enrollmentDiagnosis'));
......
...@@ -101,7 +101,7 @@ rqf.addField({ ...@@ -101,7 +101,7 @@ rqf.addField({
field: 'localizacao_id' field: 'localizacao_id'
} }
}).addValue({ }).addValue({
name: 'stage', name: 'education_level_short_id',
table: 'simcaq_relatorio_1', table: 'simcaq_relatorio_1',
tableField: 'etapa', tableField: 'etapa',
where: { where: {
...@@ -122,11 +122,13 @@ rqf.addField({ ...@@ -122,11 +122,13 @@ rqf.addField({
simcaqFirstReportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { simcaqFirstReportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.from('simcaq_relatorio_1') req.sql.from('simcaq_relatorio_1')
.field('simcaq_relatorio_1.etapa', 'stage') .field('simcaq_relatorio_1.etapa', 'education_level_short_id')
.field('simcaq_relatorio_1.turno', 'shift') .field('simcaq_relatorio_1.turno', 'shift')
.field('simcaq_relatorio_1.localizacao_id', 'location') .field('simcaq_relatorio_1.localizacao_id', 'location')
.field('SUM(simcaq_relatorio_1.num_matriculas)', 'num_enrollments') .field('SUM(simcaq_relatorio_1.num_matriculas)', 'num_enrollments')
.field('SUM(simcaq_relatorio_1.num_escolas)', 'num_schools') .field('SUM(simcaq_relatorio_1.num_escolas)', 'num_schools')
.field('ano_censo', 'year')
.group('ano_censo')
.group('simcaq_relatorio_1.etapa') .group('simcaq_relatorio_1.etapa')
.group('simcaq_relatorio_1.turno') .group('simcaq_relatorio_1.turno')
.group('simcaq_relatorio_1.localizacao_id'); .group('simcaq_relatorio_1.localizacao_id');
......
...@@ -102,6 +102,8 @@ simcaqSecondReportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -102,6 +102,8 @@ simcaqSecondReportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.field('sum(num_escolas_rural)' ,'num_schools_rural') .field('sum(num_escolas_rural)' ,'num_schools_rural')
.field('sum(num_escolas_urbana)' ,'num_schools_urban') .field('sum(num_escolas_urbana)' ,'num_schools_urban')
.field('dependencia_adm_priv', 'private_adm_dependency') .field('dependencia_adm_priv', 'private_adm_dependency')
.field('ano_censo', 'year')
.group('ano_censo')
.group('dependencia_adm_priv'); .group('dependencia_adm_priv');
next(); next();
}, query, response('simcaqSecondReport')); }, query, response('simcaqSecondReport'));
......
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