From 7e13849a499a8155f0dff58a5929e6459c94a647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20A=2E=20Okida=20Gon=C3=A7alves?= <laog19@inf.ufpr.br> Date: Tue, 28 Mar 2023 10:44:51 -0300 Subject: [PATCH] Add dims to second report and enrollment diagnosis routes --- .../routes_v2/simcaqEnrollmentDiagnosis.js | 43 +++++++++++---- src/libs/routes_v2/simcaqSecondReport.js | 55 +++++++++++++------ 2 files changed, 68 insertions(+), 30 deletions(-) diff --git a/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js b/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js index 7c13d9b4..1fb30b61 100644 --- a/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js +++ b/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js @@ -46,6 +46,10 @@ rqf.addField({ name: 'filter', field: false, where: true +}).addField({ + name: 'dims', + field: true, + where: false }).addValue({ name: 'year', table: 'simcaq_diagnostico_de_matricula', @@ -57,32 +61,47 @@ rqf.addField({ } }).addValue({ name: 'city', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'municipio_id', + table: 'municipio', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'municipio_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'municipio_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'state', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'estado_id', + table: 'estado', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'estado_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'estado_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'school', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'escola_id', + table: 'escola_agregada', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'escola_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'escola_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'education_level_short_id', table: 'simcaq_diagnostico_de_matricula', tableField: 'etapa', diff --git a/src/libs/routes_v2/simcaqSecondReport.js b/src/libs/routes_v2/simcaqSecondReport.js index 1aa89412..ccdd2f9b 100644 --- a/src/libs/routes_v2/simcaqSecondReport.js +++ b/src/libs/routes_v2/simcaqSecondReport.js @@ -46,6 +46,10 @@ rqf.addField({ name: 'filter', field: false, where: true +}).addField({ + name: 'dims', + field: true, + where: false }).addValue({ name: 'year', table: 'simcaq_relatorio_2', @@ -56,40 +60,55 @@ rqf.addField({ field: 'ano_censo' } }).addValue({ - name: 'school', - table: 'simcaq_relatorio_2', - tableField: 'escola_id', + name: 'city', + table: 'municipio', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'escola_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'municipio_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'city', - table:'simcaq_relatorio_2', - tableField: 'municipio_id', +}, 'dims').addValue({ + name: 'state', + table: 'estado', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'municipio_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'estado_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'adm_dependency', - table: 'simcaq_relatorio_2', - tableField: 'dependencia_adm_id', +}, 'dims').addValue({ + name: 'school', + table: 'escola_agregada', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'dependencia_adm_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'escola_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'state', +}, 'dims').addValue({ + name: 'adm_dependency', table: 'simcaq_relatorio_2', - tableField: 'estado_id', + tableField: 'dependencia_adm_id', where: { relation: '=', type: 'integer', - field: 'estado_id' + field: 'dependencia_adm_id' } }); -- GitLab