Skip to content
Snippets Groups Projects

Release v1.7.0

1 file
+ 16
3
Compare changes
  • Side-by-side
  • Inline
@@ -382,11 +382,13 @@ dailyChargeAmountApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
dailyChargeAmountApp.get('/average', rqf.parse(), rqf.build(), (req, res, next) => {
var status = 0;
if (('education_level_mod' in req.filter || 'education_level_mod' in req.dims)
&& ('integral_time' in req.filter)) {
if (req.filter['integral_time'] == '0'
&& ('period' in req.filter)) {
if (req.filter['period'].length == 1
if (req.dims.size > 1) status = 2;
else if (req.filter['period'].length == 1
&& req.filter['period'][0] == '3') {
status = 1;
} else if (req.filter['period'].length <= 2
@@ -396,11 +398,12 @@ dailyChargeAmountApp.get('/average', rqf.parse(), rqf.build(), (req, res, next)
status = 1;
}
} else if (req.filter['integral_time'] == '1') {
status = 1;
if (req.dims.size > 1) status = 2;
else status = 1;
}
}
if (status) {
if (status == 1) {
req.sql.from('turma')
.field('turma.ano_censo', 'year')
.field('turma.etapas_mod_ensino_segmento_id', 'education_level_mod_id')
@@ -414,6 +417,16 @@ dailyChargeAmountApp.get('/average', rqf.parse(), rqf.build(), (req, res, next)
.order('turma.ano_censo')
.order('turma.etapas_mod_ensino_segmento_id')
.where('turma.tipo_turma_id <= 3')
} else if (status == 2) {
req.sql.from('turma')
.field('turma.ano_censo', 'year')
.field('turma.etapas_mod_ensino_segmento_id', 'education_level_mod_id')
.field('AVG(turma.duracao_turma)/60.0', 'average_class_duration')
.group('turma.ano_censo')
.group('turma.etapas_mod_ensino_segmento_id')
.order('turma.ano_censo')
.order('turma.etapas_mod_ensino_segmento_id')
.where('turma.tipo_turma_id <= 3')
} else {
res.status(400);
next({
Loading