Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
4f9fd4f4
There was a problem fetching the pipeline summary.
Commit
4f9fd4f4
authored
6 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Change default query
parent
974c6376
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!128
Transport Indicator
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/transport.js
+57
-39
57 additions, 39 deletions
src/libs/routes/transport.js
with
57 additions
and
39 deletions
src/libs/routes/transport.js
+
57
−
39
View file @
4f9fd4f4
...
@@ -14,6 +14,8 @@ const multiQuery = require(`${libs}/middlewares/multiQuery`);
...
@@ -14,6 +14,8 @@ const multiQuery = require(`${libs}/middlewares/multiQuery`);
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
response
=
require
(
`
${
libs
}
/middlewares/response`
);
const
addMissing
=
require
(
`
${
libs
}
/middlewares/addMissing`
);
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
const
id2str
=
require
(
`
${
libs
}
/middlewares/id2str`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
const
ReqQueryFields
=
require
(
`
${
libs
}
/middlewares/reqQueryFields`
);
...
@@ -110,6 +112,38 @@ rqf.addField({
...
@@ -110,6 +112,38 @@ rqf.addField({
name
:
'
dims
'
,
name
:
'
dims
'
,
field
:
true
,
field
:
true
,
where
:
false
where
:
false
}).
addValue
({
name
:
'
city
'
,
table
:
'
municipio
'
,
tableField
:
'
nome
'
,
resultField
:
'
city_name
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
municipio_id
'
,
table
:
'
matricula
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
municipio_id
'
,
foreignTable
:
'
matricula
'
}
}).
addValue
({
name
:
'
state
'
,
table
:
'
estado
'
,
tableField
:
'
nome
'
,
resultField
:
'
state_name
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
estado_id
'
,
table
:
'
matricula
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
estado_id
'
,
foreignTable
:
'
matricula
'
}
}).
addValue
({
}).
addValue
({
name
:
'
rural_location
'
,
name
:
'
rural_location
'
,
table
:
'
matricula
'
,
table
:
'
matricula
'
,
...
@@ -240,42 +274,27 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -240,42 +274,27 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.
field
(
"
'Brasil'
"
,
'
name
'
)
.
field
(
"
'Brasil'
"
,
'
name
'
)
.
field
(
'
matricula.ano_censo
'
,
'
year
'
)
.
field
(
'
matricula.ano_censo
'
,
'
year
'
)
.
from
(
'
matricula
'
)
.
from
(
'
matricula
'
)
.
join
(
'
turma
'
,
null
,
'
matricula.turma_id = turma.id AND matricula.ano_censo = turma.ano_censo
'
)
.
group
(
'
matricula.ano_censo
'
)
.
group
(
'
matricula.ano_censo
'
)
.
order
(
'
matricula.ano_censo
'
)
.
order
(
'
matricula.ano_censo
'
)
.
where
(
'
turma.tipo_turma_id <= 3
'
);
.
where
(
'
matricula.tipo <= 3 AND matricula.transporte_escolar_publico
'
);
req
.
queryIndex
.
allTransports
=
req
.
querySet
.
push
(
allTransports
)
-
1
;
req
.
queryIndex
.
allTransports
=
req
.
querySet
.
push
(
allTransports
)
-
1
;
// Vans e Kombi
let
allVansAndKombi
=
allTransports
.
clone
();
allVansAndKombi
.
where
(
'
matricula.transporte_vans_kombi = 1
'
);
req
.
queryIndex
.
allVansAndKombi
=
req
.
querySet
.
push
(
allVansAndKombi
)
-
1
;
// Vans e Kombi
// Vans e Kombi
let
goVansAndKombi
=
allTransports
.
clone
();
let
goVansAndKombi
=
allTransports
.
clone
();
goVansAndKombi
.
where
(
'
matricula.transporte_vans_kombi = 1
OR matricula.transporte_vans_kombi = 0
'
);
goVansAndKombi
.
where
(
'
matricula.transporte_vans_kombi = 1
'
);
req
.
queryIndex
.
goVansAndKombi
=
req
.
querySet
.
push
(
goVansAndKombi
)
-
1
;
req
.
queryIndex
.
goVansAndKombi
=
req
.
querySet
.
push
(
goVansAndKombi
)
-
1
;
// Micro-ônibus
let
allMicroBus
=
allTransports
.
clone
();
allMicroBus
.
where
(
'
matricula.transporte_micro_onibus = 1 OR matricula.transporte_micro_onibus = 0
'
);
req
.
queryIndex
.
allMicroBus
=
req
.
querySet
.
push
(
allMicroBus
)
-
1
;
// Micro
// Micro
let
goMicroBus
=
allTransports
.
clone
();
let
goMicroBus
=
allTransports
.
clone
();
goMicroBus
.
where
(
'
matricula.transporte_micro_onibus = 1
'
);
goMicroBus
.
where
(
'
matricula.transporte_micro_onibus = 1
'
);
req
.
queryIndex
.
goMicroBus
=
req
.
querySet
.
push
(
goMicroBus
)
-
1
;
req
.
queryIndex
.
goMicroBus
=
req
.
querySet
.
push
(
goMicroBus
)
-
1
;
// Ônibus
let
allBus
=
allTransports
.
clone
();
allBus
.
where
(
'
matricula.transporte_onibus = 1 OR matricula.transporte_onibus = 0
'
);
req
.
queryIndex
.
allBus
=
req
.
querySet
.
push
(
allBus
)
-
1
;
// Ônibus
let
goBus
=
allTransports
.
clone
();
let
goBus
=
allTransports
.
clone
();
goBus
.
where
(
'
matricula.transporte_onibus = 1
'
);
goBus
.
where
(
'
matricula.transporte_onibus = 1
'
);
req
.
queryIndex
.
goBus
=
req
.
querySet
.
push
(
goBus
)
-
1
;
req
.
queryIndex
.
goBus
=
req
.
querySet
.
push
(
goBus
)
-
1
;
//
// Bicicleta
// Bicicleta
let
goBikes
=
allTransports
.
clone
();
let
goBikes
=
allTransports
.
clone
();
goBikes
.
where
(
'
matricula.transporte_bicicleta = 1
'
);
goBikes
.
where
(
'
matricula.transporte_bicicleta = 1
'
);
...
@@ -296,6 +315,7 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -296,6 +315,7 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
goWaterway_5_Students
.
where
(
'
matricula.transporte_embar_0_5 = 1
'
);
goWaterway_5_Students
.
where
(
'
matricula.transporte_embar_0_5 = 1
'
);
req
.
queryIndex
.
goWaterway_5_Students
=
req
.
querySet
.
push
(
goWaterway_5_Students
)
-
1
;
req
.
queryIndex
.
goWaterway_5_Students
=
req
.
querySet
.
push
(
goWaterway_5_Students
)
-
1
;
// Aquaviário/ Embarcação (capacidade de 5 até 15 alunos)
// Aquaviário/ Embarcação (capacidade de 5 até 15 alunos)
let
goWaterway_15_Students
=
allTransports
.
clone
();
let
goWaterway_15_Students
=
allTransports
.
clone
();
goWaterway_15_Students
.
where
(
'
matricula.transporte_embar_5_15 = 1
'
);
goWaterway_15_Students
.
where
(
'
matricula.transporte_embar_5_15 = 1
'
);
...
@@ -317,23 +337,23 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -317,23 +337,23 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goSubwayAndTrain
=
req
.
querySet
.
push
(
goSubwayAndTrain
)
-
1
;
req
.
queryIndex
.
goSubwayAndTrain
=
req
.
querySet
.
push
(
goSubwayAndTrain
)
-
1
;
next
();
next
();
},
multiQuery
,
(
req
,
res
,
next
)
=>
{
},
multiQuery
,
(
req
,
res
,
next
)
=>
{
// let van_and_kombi = matchQueries(req.result[req.queryIndex.goVansAndKombi], req.result[req.queryIndex.allVansAndKombi]);
// let microBus = matchQueries(req.result[req.queryIndex.goMicroBus], req.result[req.queryIndex.allMicroBus]);
let
public_transport
=
req
.
result
[
req
.
queryIndex
.
allTransports
];
// let Bus = matchQueries(req.result[req.queryIndex.goBus], req.result[req.queryIndex.allBus]);
let
van_and_kombi
=
req
.
result
[
req
.
queryIndex
.
goVansAndKombi
];
let
van_and_kombi
=
req
.
result
[
req
.
queryIndex
.
goVansAndKombi
]
let
micro_bus
=
req
.
result
[
req
.
queryIndex
.
goMicroBus
];
let
micro_bus
=
req
.
result
[
req
.
queryIndex
.
goMicroBus
]
let
Bus
=
req
.
result
[
req
.
queryIndex
.
goBus
];
let
Bus
=
req
.
result
[
req
.
queryIndex
.
goBus
]
let
bike
=
req
.
result
[
req
.
queryIndex
.
goBikes
];
let
bike
=
req
.
result
[
req
.
queryIndex
.
goBikes
]
let
animal_traction
=
req
.
result
[
req
.
queryIndex
.
goAnimalTraction
];
let
animal_traction
=
req
.
result
[
req
.
queryIndex
.
goAnimalTraction
]
let
other_vehicle
=
req
.
result
[
req
.
queryIndex
.
goOtherVehicle
];
let
other_vehicle
=
req
.
result
[
req
.
queryIndex
.
goOtherVehicle
]
let
waterway_5_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_5_Students
];
let
waterway_5_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_5_Students
]
let
waterway_15_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_15_Students
];
let
waterway_10_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_10_Students
]
let
waterway_35_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_35_Students
];
let
waterway_15_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_15_Students
]
let
waterway_More_Than_35
=
req
.
result
[
req
.
queryIndex
.
goWaterwayMoreThan_35
];
let
waterway_35_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_35_Students
]
let
subway_and_train
=
req
.
result
[
req
.
queryIndex
.
goSubwayAndTrain
];
let
waterway_More_Than_35
=
req
.
result
[
req
.
queryIndex
.
goWaterwayMoreThan_35
]
let
subway_and_train
=
req
.
result
[
req
.
queryIndex
.
goSubwayAndTrain
]
req
.
result
=
[{
req
.
result
=
[{
public_transport
,
van_and_kombi
,
van_and_kombi
,
micro_bus
,
micro_bus
,
Bus
,
Bus
,
...
@@ -341,14 +361,12 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -341,14 +361,12 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
animal_traction
,
animal_traction
,
other_vehicle
,
other_vehicle
,
waterway_5_Students
,
waterway_5_Students
,
waterway_10_Students
,
waterway_15_Students
,
waterway_15_Students
,
waterway_35_Students
,
waterway_35_Students
,
waterway_More_Than_35
,
waterway_More_Than_35
,
subway_and_train
subway_and_train
}];
}]
next
();
next
();
}
,
response
(
'
transports
'
));
},
id2str
.
multitransform
(
false
)
,
response
(
'
transports
'
));
module
.
exports
=
transportApp
;
module
.
exports
=
transportApp
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment