From 3d8a00b136d78751cc60fcc4c88fcd3218566c1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor=20Tozatti=20Risso?= <jvtr12@c3sl.ufpr.br> Date: Mon, 11 Jul 2016 10:29:25 -0300 Subject: [PATCH] Fix condition to set start and end years in enrollments route MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Victor Tozatti Risso <jvtr12@c3sl.ufpr.br> --- libs/routes/api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/routes/api.js b/libs/routes/api.js index 4440b991..b2079e5f 100644 --- a/libs/routes/api.js +++ b/libs/routes/api.js @@ -78,7 +78,7 @@ router.get('/enrollments.:format?', function(req, res) { if (params.start_year) { start_year = parseInt(params.start_year, 10); - } else if (start_year > 0) { // if start_year was not previously set + } else if (start_year == 0) { // if start_year was not previously set var yearSql = "SELECT MIN(t.ano_censo) AS start_year FROM turmas AS t"; conn.query(yearSql, true).then(function(result) { start_year = result.data.start_year; @@ -88,7 +88,7 @@ router.get('/enrollments.:format?', function(req, res) { if (params.end_year) { end_year = parseInt(params.end_year, 10); - } else if (end_year > 0) { // if end_year was not previously set + } else if (end_year == 0) { // if end_year was not previously set var yearSql = "SELECT MAX(t.ano_censo) AS end_year FROM turmas AS t"; conn.query(yearSql, true).then(function(result) { end_year = result.data.end_year; -- GitLab