From 62ef72c57aeebf8ecfdadb4323ad38e822e2c3cd Mon Sep 17 00:00:00 2001 From: Vytor Calixto <vytorcalixto@gmail.com> Date: Mon, 6 Nov 2017 09:20:43 -0200 Subject: [PATCH] Add min_year and max_year to infrastrucutre --- src/libs/routes/infrastructure.js | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/libs/routes/infrastructure.js b/src/libs/routes/infrastructure.js index de76386f..15eabde4 100644 --- a/src/libs/routes/infrastructure.js +++ b/src/libs/routes/infrastructure.js @@ -152,17 +152,6 @@ rqf.addField({ foreign: 'regiao_id', foreignTable: 'escola' } -}).addValue({ - name: 'year', - table: 'escola', - tableField: 'ano_censo', - resultField: 'year', - where: { - relation: '=', - type: 'integer', - field: 'ano_censo', - table: 'escola' - } }).addValue({ name: 'location', table: 'escola', @@ -203,7 +192,27 @@ rqf.addField({ type: 'integer', field: 'dependencia_adm_priv' } -}) +}).addValue({ + name: 'min_year', + table: 'escola', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '>=', + type: 'integer', + field: 'ano_censo' + } +}).addValue({ + name: 'max_year', + table: 'escola', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '<=', + type: 'integer', + field: 'ano_censo' + } +}); function matchQueries(queryTotal, queryPartial) { let match = []; -- GitLab