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
06c87129
Commit
06c87129
authored
6 years ago
by
Fernando Erd
Browse files
Options
Downloads
Patches
Plain Diff
Add percentage
parent
a786b0be
No related branches found
No related tags found
1 merge request
!134
Transport Indicator
Pipeline
#16199
failed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/transport.js
+36
-35
36 additions, 35 deletions
src/libs/routes/transport.js
with
36 additions
and
35 deletions
src/libs/routes/transport.js
+
36
−
35
View file @
06c87129
...
@@ -320,7 +320,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -320,7 +320,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
allTransports
=
req
.
querySet
.
push
(
allTransports
)
-
1
;
req
.
queryIndex
.
allTransports
=
req
.
querySet
.
push
(
allTransports
)
-
1
;
// Vans e Kombi
// Vans e Kombi
console
.
log
(
"
------------------------------------------------------
"
)
let
goVansAndKombi
=
allTransports
.
clone
();
let
goVansAndKombi
=
allTransports
.
clone
();
goVansAndKombi
.
field
(
'
matricula.transporte_vans_kombi
'
,
'
use_transport_id
'
)
goVansAndKombi
.
field
(
'
matricula.transporte_vans_kombi
'
,
'
use_transport_id
'
)
goVansAndKombi
.
where
(
'
matricula.transporte_vans_kombi = 1 OR matricula.transporte_vans_kombi = 0
'
);
goVansAndKombi
.
where
(
'
matricula.transporte_vans_kombi = 1 OR matricula.transporte_vans_kombi = 0
'
);
...
@@ -328,7 +327,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -328,7 +327,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goVansAndKombi
=
req
.
querySet
.
push
(
goVansAndKombi
)
-
1
;
req
.
queryIndex
.
goVansAndKombi
=
req
.
querySet
.
push
(
goVansAndKombi
)
-
1
;
// Micro
// Micro
console
.
log
(
"
------------------------------------------------------
"
)
let
goMicroBus
=
allTransports
.
clone
();
let
goMicroBus
=
allTransports
.
clone
();
goMicroBus
.
field
(
'
matricula.transporte_micro_onibus
'
,
'
use_transport_id
'
)
goMicroBus
.
field
(
'
matricula.transporte_micro_onibus
'
,
'
use_transport_id
'
)
goMicroBus
.
where
(
'
matricula.transporte_micro_onibus = 1 OR matricula.transporte_micro_onibus = 0
'
);
goMicroBus
.
where
(
'
matricula.transporte_micro_onibus = 1 OR matricula.transporte_micro_onibus = 0
'
);
...
@@ -337,7 +335,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -337,7 +335,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
// Ônibus
// Ônibus
console
.
log
(
"
------------------------------------------------------
"
)
let
goBus
=
allTransports
.
clone
();
let
goBus
=
allTransports
.
clone
();
goBus
.
field
(
"
matricula.transporte_onibus
"
,
'
use_transport_id
'
)
goBus
.
field
(
"
matricula.transporte_onibus
"
,
'
use_transport_id
'
)
goBus
.
where
(
'
matricula.transporte_onibus = 1 OR matricula.transporte_onibus = 0
'
);
goBus
.
where
(
'
matricula.transporte_onibus = 1 OR matricula.transporte_onibus = 0
'
);
...
@@ -345,7 +342,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -345,7 +342,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goBus
=
req
.
querySet
.
push
(
goBus
)
-
1
;
req
.
queryIndex
.
goBus
=
req
.
querySet
.
push
(
goBus
)
-
1
;
// Bicicleta
// Bicicleta
console
.
log
(
"
------------------------------------------------------
"
)
let
goBikes
=
allTransports
.
clone
();
let
goBikes
=
allTransports
.
clone
();
goBikes
.
field
(
'
matricula.transporte_bicicleta
'
,
'
use_transport_id
'
)
goBikes
.
field
(
'
matricula.transporte_bicicleta
'
,
'
use_transport_id
'
)
goBikes
.
where
(
'
matricula.transporte_bicicleta = 1 OR matricula.transporte_bicicleta = 0
'
);
goBikes
.
where
(
'
matricula.transporte_bicicleta = 1 OR matricula.transporte_bicicleta = 0
'
);
...
@@ -353,7 +349,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -353,7 +349,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goBikes
=
req
.
querySet
.
push
(
goBikes
)
-
1
;
req
.
queryIndex
.
goBikes
=
req
.
querySet
.
push
(
goBikes
)
-
1
;
// Tração Animal
// Tração Animal
console
.
log
(
"
------------------------------------------------------
"
)
let
goAnimalTraction
=
allTransports
.
clone
();
let
goAnimalTraction
=
allTransports
.
clone
();
goAnimalTraction
.
field
(
'
matricula.transporte_animal
'
,
'
use_transport_id
'
)
goAnimalTraction
.
field
(
'
matricula.transporte_animal
'
,
'
use_transport_id
'
)
goAnimalTraction
.
where
(
'
matricula.transporte_animal = 1 OR matricula.transporte_animal = 0
'
);
goAnimalTraction
.
where
(
'
matricula.transporte_animal = 1 OR matricula.transporte_animal = 0
'
);
...
@@ -361,7 +356,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -361,7 +356,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goAnimalTraction
=
req
.
querySet
.
push
(
goAnimalTraction
)
-
1
;
req
.
queryIndex
.
goAnimalTraction
=
req
.
querySet
.
push
(
goAnimalTraction
)
-
1
;
// Outro Veículo
// Outro Veículo
console
.
log
(
"
------------------------------------------------------
"
)
let
goOtherVehicle
=
allTransports
.
clone
();
let
goOtherVehicle
=
allTransports
.
clone
();
goOtherVehicle
.
field
(
'
matricula.transporte_outro
'
,
'
use_transport_id
'
)
goOtherVehicle
.
field
(
'
matricula.transporte_outro
'
,
'
use_transport_id
'
)
goOtherVehicle
.
where
(
'
matricula.transporte_outro = 1 OR matricula.transporte_outro = 0
'
);
goOtherVehicle
.
where
(
'
matricula.transporte_outro = 1 OR matricula.transporte_outro = 0
'
);
...
@@ -369,7 +363,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -369,7 +363,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goOtherVehicle
=
req
.
querySet
.
push
(
goOtherVehicle
)
-
1
;
req
.
queryIndex
.
goOtherVehicle
=
req
.
querySet
.
push
(
goOtherVehicle
)
-
1
;
// Aquaviário/ Embarcação (capacidade até 5 alunos)
// Aquaviário/ Embarcação (capacidade até 5 alunos)
console
.
log
(
"
------------------------------------------------------
"
)
let
goWaterway_5_Students
=
allTransports
.
clone
();
let
goWaterway_5_Students
=
allTransports
.
clone
();
goWaterway_5_Students
.
field
(
'
matricula.transporte_embar_0_5
'
,
'
use_transport_id
'
)
goWaterway_5_Students
.
field
(
'
matricula.transporte_embar_0_5
'
,
'
use_transport_id
'
)
goWaterway_5_Students
.
where
(
'
matricula.transporte_embar_0_5 = 1 OR matricula.transporte_embar_0_5 = 0
'
);
goWaterway_5_Students
.
where
(
'
matricula.transporte_embar_0_5 = 1 OR matricula.transporte_embar_0_5 = 0
'
);
...
@@ -377,7 +370,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -377,7 +370,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
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)
console
.
log
(
"
------------------------------------------------------
"
)
let
goWaterway_15_Students
=
allTransports
.
clone
();
let
goWaterway_15_Students
=
allTransports
.
clone
();
goWaterway_15_Students
.
field
(
'
matricula.transporte_embar_5_15
'
,
'
use_transport_id
'
)
goWaterway_15_Students
.
field
(
'
matricula.transporte_embar_5_15
'
,
'
use_transport_id
'
)
goWaterway_15_Students
.
where
(
'
matricula.transporte_embar_5_15 = 1 OR matricula.transporte_embar_5_15 = 0
'
);
goWaterway_15_Students
.
where
(
'
matricula.transporte_embar_5_15 = 1 OR matricula.transporte_embar_5_15 = 0
'
);
...
@@ -385,7 +377,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -385,7 +377,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goWaterway_15_Students
=
req
.
querySet
.
push
(
goWaterway_15_Students
)
-
1
;
req
.
queryIndex
.
goWaterway_15_Students
=
req
.
querySet
.
push
(
goWaterway_15_Students
)
-
1
;
// Aquaviário/ Embarcação (capacidade de 15 até 35 alunos)r
// Aquaviário/ Embarcação (capacidade de 15 até 35 alunos)r
console
.
log
(
"
------------------------------------------------------
"
)
let
goWaterway_35_Students
=
allTransports
.
clone
();
let
goWaterway_35_Students
=
allTransports
.
clone
();
goWaterway_35_Students
.
field
(
'
matricula.transporte_embar_15_35
'
,
'
use_transport_id
'
)
goWaterway_35_Students
.
field
(
'
matricula.transporte_embar_15_35
'
,
'
use_transport_id
'
)
goWaterway_35_Students
.
where
(
'
matricula.transporte_embar_15_35 = 1 OR matricula.transporte_embar_15_35 = 0
'
);
goWaterway_35_Students
.
where
(
'
matricula.transporte_embar_15_35 = 1 OR matricula.transporte_embar_15_35 = 0
'
);
...
@@ -393,7 +384,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -393,7 +384,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goWaterway_35_Students
=
req
.
querySet
.
push
(
goWaterway_35_Students
)
-
1
;
req
.
queryIndex
.
goWaterway_35_Students
=
req
.
querySet
.
push
(
goWaterway_35_Students
)
-
1
;
// Aquaviário/ Embarcação (capacidade mais 35 alunos)
// Aquaviário/ Embarcação (capacidade mais 35 alunos)
console
.
log
(
"
------------------------------------------------------
"
)
let
goWaterwayMoreThan_35
=
allTransports
.
clone
();
let
goWaterwayMoreThan_35
=
allTransports
.
clone
();
goWaterwayMoreThan_35
.
field
(
'
matricula.transporte_embar_35
'
,
'
use_transport_id
'
)
goWaterwayMoreThan_35
.
field
(
'
matricula.transporte_embar_35
'
,
'
use_transport_id
'
)
goWaterwayMoreThan_35
.
where
(
'
matricula.transporte_embar_35 = 1 OR matricula.transporte_embar_35 = 0
'
);
goWaterwayMoreThan_35
.
where
(
'
matricula.transporte_embar_35 = 1 OR matricula.transporte_embar_35 = 0
'
);
...
@@ -401,7 +391,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -401,7 +391,6 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req
.
queryIndex
.
goWaterwayMoreThan_35
=
req
.
querySet
.
push
(
goWaterwayMoreThan_35
)
-
1
;
req
.
queryIndex
.
goWaterwayMoreThan_35
=
req
.
querySet
.
push
(
goWaterwayMoreThan_35
)
-
1
;
// Trêm / Metrô
// Trêm / Metrô
console
.
log
(
"
------------------------------------------------------
"
)
let
goSubwayAndTrain
=
allTransports
.
clone
();
let
goSubwayAndTrain
=
allTransports
.
clone
();
goSubwayAndTrain
.
field
(
'
matricula.transporte_trem_metro
'
,
'
use_transport_id
'
)
goSubwayAndTrain
.
field
(
'
matricula.transporte_trem_metro
'
,
'
use_transport_id
'
)
goSubwayAndTrain
.
where
(
'
matricula.transporte_trem_metro = 1 OR matricula.transporte_trem_metro = 0
'
);
goSubwayAndTrain
.
where
(
'
matricula.transporte_trem_metro = 1 OR matricula.transporte_trem_metro = 0
'
);
...
@@ -410,33 +399,45 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
...
@@ -410,33 +399,45 @@ transportApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next
();
next
();
},
multiQuery
,
(
req
,
res
,
next
)
=>
{
},
multiQuery
,
(
req
,
res
,
next
)
=>
{
let
transport_match
=
[];
let
transport_match_0
=
JSON
.
parse
(
JSON
.
stringify
(
req
.
result
[
req
.
queryIndex
.
allTransports
]));
let
transport_match_1
=
JSON
.
parse
(
JSON
.
stringify
(
req
.
result
[
req
.
queryIndex
.
allTransports
]));
let
public_transport
=
req
.
result
[
req
.
queryIndex
.
allTransports
];
//modifica adicionando use_transport_id=false, com os mesmos valores
//do transport_id=true, usado para dar o match e fazer a divisão.
for
(
let
i
=
0
;
i
<
transport_match_0
.
length
;
i
++
)
{
transport_match_0
[
i
].
use_transport_id
=
true
;
transport_match
.
push
(
transport_match_0
[
i
])
transport_match_1
[
i
].
use_transport_id
=
false
;
transport_match
.
push
(
transport_match_1
[
i
])
}
let
public_transport
=
req
.
result
[
req
.
queryIndex
.
allEnrollment
];
let
van_and_kombi
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goVansAndKombi
]);
let
van_and_kombi
=
req
.
result
[
req
.
queryIndex
.
goVansAndKombi
];
let
micro_bus
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goMicroBus
]);
let
micro_bus
=
req
.
result
[
req
.
queryIndex
.
goMicroBus
];
let
bus
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goBus
]);
let
Bus
=
req
.
result
[
req
.
queryIndex
.
goBus
];
let
bike
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goBikes
]);
let
bike
=
req
.
result
[
req
.
queryIndex
.
goBikes
];
let
animal_traction
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goAnimalTraction
]);
let
animal_traction
=
req
.
result
[
req
.
queryIndex
.
goAnimalTraction
];
let
other_vehicle
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goOtherVehicle
]);
let
other_vehicle
=
req
.
result
[
req
.
queryIndex
.
goOtherVehicle
];
let
waterway_5_Students
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goWaterway_5_Students
]);
let
waterway_5_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_5_Students
];
let
waterway_15_Students
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goWaterway_15_Students
]);
let
waterway_15_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_15_Students
];
let
waterway_35_Students
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goWaterway_35_Students
]);
let
waterway_35_Students
=
req
.
result
[
req
.
queryIndex
.
goWaterway_35_Students
];
let
waterway_More_Than_35
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goWaterwayMoreThan_35
]);
let
waterway_More_Than_35
=
req
.
result
[
req
.
queryIndex
.
goWaterwayMoreThan_35
];
let
subway_and_train
=
matchQueries
(
transport_match
,
req
.
result
[
req
.
queryIndex
.
goSubwayAndTrain
]);
let
subway_and_train
=
req
.
result
[
req
.
queryIndex
.
goSubwayAndTrain
];
req
.
result
=
[{
req
.
result
=
[{
public_transport
,
public_transport
,
van_and_kombi
,
van_and_kombi
,
micro_bus
,
micro_bus
,
B
us
,
b
us
,
bike
,
bike
,
animal_traction
,
animal_traction
,
other_vehicle
,
other_vehicle
,
waterway_5_Students
,
waterway_5_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
();
},
id2str
.
multitransform
(
false
),
response
(
'
transports
'
));
},
id2str
.
multitransform
(
false
),
response
(
'
transports
'
));
...
...
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