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
eb7d49d8
There was a problem fetching the pipeline summary.
Commit
eb7d49d8
authored
6 years ago
by
Fernando Erd
Browse files
Options
Downloads
Plain Diff
Merge branch 'development' of gitlab.c3sl.ufpr.br:simcaq/simcaq-node into development
parents
06a91799
b0c5d193
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/libs/routes/api.js
+1
-1
1 addition, 1 deletion
src/libs/routes/api.js
src/libs/routes/dailyChargeAmount.js
+13
-13
13 additions, 13 deletions
src/libs/routes/dailyChargeAmount.js
src/test/dailyChargeAmount.js
+9
-9
9 additions, 9 deletions
src/test/dailyChargeAmount.js
with
23 additions
and
23 deletions
src/libs/routes/api.js
+
1
−
1
View file @
eb7d49d8
...
...
@@ -102,7 +102,7 @@ api.use('/distribution_factor', distributionFactor);
api
.
use
(
'
/siope
'
,
siope
);
api
.
use
(
'
/out_of_school
'
,
outOfSchool
);
api
.
use
(
'
/classroom_count
'
,
classroomCount
);
api
.
use
(
'
/daily
C
harge
A
mount
'
,
dailyChargeAmount
);
api
.
use
(
'
/daily
_c
harge
_a
mount
'
,
dailyChargeAmount
);
api
.
use
(
'
/transport
'
,
transport
);
module
.
exports
=
api
;
This diff is collapsed.
Click to expand it.
src/libs/routes/dailyChargeAmount.js
+
13
−
13
View file @
eb7d49d8
const
express
=
require
(
'
express
'
);
const
dailyChargeAmount
=
express
.
Router
();
const
dailyChargeAmount
App
=
express
.
Router
();
const
libs
=
`
${
process
.
cwd
()}
/libs`
;
...
...
@@ -31,27 +31,27 @@ const cache = require('apicache').options({ debug: config.debug, statusCodes: {i
let
rqf
=
new
ReqQueryFields
();
let
rqfCount
=
new
ReqQueryFields
();
dailyChargeAmount
.
get
(
'
/year_range
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/year_range
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
turma
'
)
.
field
(
'
MIN(turma.ano_censo)
'
,
'
start_year
'
)
.
field
(
'
MAX(turma.ano_censo)
'
,
'
end_year
'
);
next
();
},
query
,
response
(
'
range
'
));
dailyChargeAmount
.
get
(
'
/years
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/years
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
turma
'
)
.
field
(
'
DISTINCT turma.ano_censo
'
,
'
year
'
);
next
();
},
query
,
response
(
'
years
'
));
dailyChargeAmount
.
get
(
'
/source
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/source
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
fonte
'
)
.
field
(
'
fonte
'
,
'
source
'
)
.
where
(
'
tabela =
\'
turma
\'
'
);
next
();
},
query
,
response
(
'
source
'
));
dailyChargeAmount
.
get
(
'
/adm_dependency
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/adm_dependency
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[];
for
(
let
i
=
1
;
i
<=
4
;
++
i
)
{
req
.
result
.
push
({
...
...
@@ -62,7 +62,7 @@ dailyChargeAmount.get('/adm_dependency', (req, res, next) => {
next
();
},
response
(
'
adm_dependency
'
));
dailyChargeAmount
.
get
(
'
/adm_dependency_detailed
'
,
cache
(
'
15 day
'
),
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/adm_dependency_detailed
'
,
cache
(
'
15 day
'
),
(
req
,
res
,
next
)
=>
{
req
.
result
=
[];
for
(
let
i
=
1
;
i
<=
6
;
++
i
)
{
req
.
result
.
push
({
...
...
@@ -73,7 +73,7 @@ dailyChargeAmount.get('/adm_dependency_detailed', cache('15 day'), (req, res, ne
next
();
},
response
(
'
adm_dependency_detailed
'
));
dailyChargeAmount
.
get
(
'
/location
'
,
cache
(
'
15 day
'
),
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/location
'
,
cache
(
'
15 day
'
),
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
1
,
name
:
'
Urbana
'
},
{
id
:
2
,
name
:
'
Rural
'
}
...
...
@@ -81,7 +81,7 @@ dailyChargeAmount.get('/location', cache('15 day'), (req, res, next) => {
next
();
},
response
(
'
location
'
));
dailyChargeAmount
.
get
(
'
/rural_location
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/rural_location
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
1
,
name
:
"
Urbana
"
},
{
id
:
2
,
name
:
"
Rural
"
},
...
...
@@ -93,7 +93,7 @@ dailyChargeAmount.get('/rural_location', (req, res, next) => {
next
();
},
response
(
'
rural_location
'
));
dailyChargeAmount
.
get
(
'
/education_level_short
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/education_level_short
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
null
,
name
:
'
Não classificada
'
},
{
id
:
1
,
name
:
'
Creche
'
},
...
...
@@ -107,7 +107,7 @@ dailyChargeAmount.get('/education_level_short', (req, res, next) => {
next
();
},
response
(
'
education_level_short
'
));
dailyChargeAmount
.
get
(
'
/average/education_level_mod
'
,
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/average/education_level_mod
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
null
,
name
:
'
Não classificada
'
},
{
id
:
1
,
name
:
'
Creche
'
},
...
...
@@ -266,7 +266,7 @@ rqf.addField({
}
});
dailyChargeAmount
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
var
status
=
0
;
if
(
'
integral_time
'
in
req
.
filter
)
{
if
(
req
.
filter
[
'
integral_time
'
]
==
'
0
'
...
...
@@ -325,7 +325,7 @@ dailyChargeAmount.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
next
();
},
id2str
.
transform
(),
response
(
'
turma
'
));
dailyChargeAmount
.
get
(
'
/average
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
dailyChargeAmount
App
.
get
(
'
/average
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
var
status
=
0
;
if
((
'
education_level_mod
'
in
req
.
filter
||
'
education_level_mod
'
in
req
.
dims
)
&&
(
'
integral_time
'
in
req
.
filter
))
{
...
...
@@ -381,4 +381,4 @@ dailyChargeAmount.get('/average', rqf.parse(), rqf.build(), (req, res, next) =>
next
();
},
id2str
.
transform
(),
response
(
'
turma
'
));
module
.
exports
=
dailyChargeAmount
;
module
.
exports
=
dailyChargeAmount
App
;
This diff is collapsed.
Click to expand it.
src/test/dailyChargeAmount.js
+
9
−
9
View file @
eb7d49d8
...
...
@@ -26,7 +26,7 @@ chai.use(chaiHttp);
describe
(
'
request daily charge amount
'
,
()
=>
{
it
(
'
should list the year range
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/year_range
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/year_range
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -40,7 +40,7 @@ describe('request daily charge amount', () => {
it
(
'
should list the year range
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/years
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/years
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -53,7 +53,7 @@ describe('request daily charge amount', () => {
it
(
'
should list the locations
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/location
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/location
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -67,7 +67,7 @@ describe('request daily charge amount', () => {
it
(
'
should list education level short
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/education_level_short
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/education_level_short
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -81,7 +81,7 @@ describe('request daily charge amount', () => {
it
(
'
should list education level mod
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/education_level_mod
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/education_level_mod
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -95,7 +95,7 @@ describe('request daily charge amount', () => {
it
(
'
should list the dimensions of education_level_short
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount?dims=education_level_short&filter=min_year:"2015",max_year:"2015",integral_time:"0",period:["3"]
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount?dims=education_level_short&filter=min_year:"2015",max_year:"2015",integral_time:"0",period:["3"]
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -115,7 +115,7 @@ describe('request daily charge amount', () => {
it
(
'
should list the filter of education level mod
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/average?filter=education_level_mod:["3","4","5","6"],integral_time:"0",period:["3"]
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/average?filter=education_level_mod:["3","4","5","6"],integral_time:"0",period:["3"]
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
@@ -131,7 +131,7 @@ describe('request daily charge amount', () => {
it
(
'
should return 400 with no filters
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
400
);
res
.
should
.
be
.
json
;
...
...
@@ -143,7 +143,7 @@ describe('request daily charge amount', () => {
it
(
'
should return 400 with no filters
'
,
(
done
)
=>
{
chai
.
request
(
server
)
.
get
(
'
/api/v1/daily
C
harge
A
mount/average?filter=education_level_mod:["3","4","5","6"]
'
)
.
get
(
'
/api/v1/daily
_c
harge
_a
mount/average?filter=education_level_mod:["3","4","5","6"]
'
)
.
end
((
err
,
res
)
=>
{
res
.
should
.
have
.
status
(
200
);
res
.
should
.
be
.
json
;
...
...
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