From b364d021dc66259d8262035b15135068ab42b88c Mon Sep 17 00:00:00 2001
From: Gabriel Ruschel <grc15@inf.ufpr.br>
Date: Tue, 25 Jul 2017 11:43:59 -0300
Subject: [PATCH] Order adm_dependency and adm_dependency_detailed by id

---
 src/libs/routes/school.js | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/src/libs/routes/school.js b/src/libs/routes/school.js
index de84d69d..2012d8a6 100644
--- a/src/libs/routes/school.js
+++ b/src/libs/routes/school.js
@@ -479,33 +479,23 @@ rqfCount.addField({
     }
 }).addValue({
     name: 'adm_dependency',
-    table: 'dependencia_adm',
-    tableField: 'nome',
-    resultField: 'adm_dependency_name',
+    table: 'escola',
+    tableField: 'dependencia_adm_id',
+    resultField: 'adm_dependency_id',
     where: {
         relation: '=',
         type: 'integer',
-        field: 'id'
-    },
-    join: {
-        primary: 'id',
-        foreign: 'dependencia_adm_id',
-        foreignTable: 'escola'
+        field: 'dependencia_adm_id'
     }
 }).addValue({
     name: 'adm_dependency_detailed',
-    table: 'dependencia_adm',
-    tableField: 'nome',
-    resultField: 'adm_dependency_detailed_name',
+    table: 'escola',
+    tableField: 'dependencia_adm_priv',
+    resultField: 'adm_dependency_detailed_id',
     where: {
         relation: '=',
         type: 'integer',
-        field: 'id'
-    },
-    join: {
-        primary: 'id',
-        foreign: 'dependencia_adm_priv',
-        foreignTable: 'escola'
+        field: 'dependencia_adm_priv'
     }
 }).addValue({
     name: 'location',
-- 
GitLab