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
9e8d34fe
Commit
9e8d34fe
authored
5 years ago
by
Victor Picussa
Browse files
Options
Downloads
Patches
Plain Diff
[homologa]Added course modifications
parent
800adc24
No related branches found
No related tags found
1 merge request
!257
V1.14.0
Pipeline
#23072
failed
5 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes/courseCount.js
+71
-41
71 additions, 41 deletions
src/libs/routes/courseCount.js
with
71 additions
and
41 deletions
src/libs/routes/courseCount.js
+
71
−
41
View file @
9e8d34fe
...
...
@@ -40,12 +40,8 @@ const config = require(`${libs}/config`);
const
addMissing
=
require
(
`
${
libs
}
/middlewares/addMissing`
);
const
cache
=
require
(
'
apicache
'
).
options
({
debug
:
config
.
debug
,
statusCodes
:
{
include
:
[
200
]}
}).
middleware
;
let
rqf
=
new
ReqQueryFields
();
courseCountApp
.
use
(
cache
(
'
15 day
'
));
courseCountApp
.
get
(
'
/upper_adm_dependency
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[];
for
(
let
i
=
1
;
i
<=
7
;
++
i
)
{
...
...
@@ -59,7 +55,8 @@ courseCountApp.get('/upper_adm_dependency', (req, res, next) => {
courseCountApp
.
get
(
'
/years
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
curso_ens_superior
'
)
.
field
(
'
DISTINCT curso_ens_superior.ano_censo
'
,
'
year
'
);
.
field
(
'
DISTINCT curso_ens_superior.ano_censo
'
,
'
year
'
)
.
where
(
'
curso_ens_superior.ano_censo > 2010
'
);
next
();
},
query
,
response
(
'
years
'
));
...
...
@@ -81,15 +78,6 @@ courseCountApp.get('/academic_organization', (req, res, next) => {
next
();
},
response
(
'
academic_organization
'
));
courseCountApp
.
get
(
'
/capital
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[
{
id
:
null
,
name
:
'
Não Classificado
'
},
{
id
:
0
,
name
:
'
Não
'
},
{
id
:
1
,
name
:
'
Sim
'
}
];
next
();
},
response
(
'
capital
'
));
courseCountApp
.
get
(
'
/ocde_geral
'
,
(
req
,
res
,
next
)
=>
{
req
.
result
=
[];
for
(
let
i
=
1
;
i
<=
8
;
++
i
)
{
...
...
@@ -186,6 +174,13 @@ courseCountApp.get('/university', (req, res, next) => {
next
();
},
query
,
response
(
'
university
'
));
courseCountApp
.
get
(
'
/localoffer
'
,
(
req
,
res
,
next
)
=>
{
req
.
sql
.
from
(
'
localoferta_ens_superior
'
,
'
l
'
)
.
field
(
'
DISTINCT l.nome
'
,
'
localoffer_name
'
)
.
field
(
'
l.cod_local_oferta
'
,
'
localoffer_id
'
);
next
();
},
query
,
response
(
'
localoffer
'
));
rqf
.
addField
({
name
:
'
filter
'
,
field
:
false
,
...
...
@@ -200,8 +195,8 @@ rqf.addField({
tableField
:
[
'
nome
'
,
'
id
'
],
resultField
:
[
'
region_name
'
,
'
region_id
'
],
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
relation
:
'
LIKE
'
,
type
:
'
string
'
,
field
:
'
id
'
},
join
:
{
...
...
@@ -211,34 +206,51 @@ rqf.addField({
}
}).
addValue
({
name
:
'
state
'
,
table
:
'
estado
'
,
tableField
:
[
'
nome
'
,
'
id
'
],
table
:
'
localoferta_ens_superior
'
,
tableField
:
[
'
sigla_uf
'
,
'
cod_uf
'
],
resultField
:
[
'
state_name
'
,
'
state_id
'
],
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
id
'
field
:
'
cod_uf_curso
'
,
table
:
'
curso_ens_superior
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
cod_
uf_
curso
'
,
primary
:
[
'
ano_censo
'
,
'
cod_curso
'
]
,
foreign
:
[
'
ano_censo
'
,
'
cod_curso
'
]
,
foreignTable
:
'
curso_ens_superior
'
}
}).
addValue
({
name
:
'
city
'
,
table
:
'
municip
io
'
,
tableField
:
[
'
nome
'
,
'
id
'
],
table
:
'
localoferta_ens_super
io
r
'
,
tableField
:
[
'
nome
_municipio
'
,
'
cod_municipio
'
],
resultField
:
[
'
city_name
'
,
'
city_id
'
],
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
cod_
municipio_
curso
'
,
table
:
'
@
'
field
:
'
cod_curso
'
,
table
:
'
curso_ens_superior
'
},
join
:
{
primary
:
'
id
'
,
foreign
:
'
cod_municipio_curso
'
,
foreignTable
:
'
@
'
primary
:
[
'
ano_censo
'
,
'
cod_curso
'
],
foreign
:
[
'
ano_censo
'
,
'
cod_curso
'
],
foreignTable
:
'
curso_ens_superior
'
}
}).
addValue
({
name
:
'
localoffer
'
,
table
:
'
localoferta_ens_superior
'
,
tableField
:
[
'
cod_ies
'
,
'
cod_local_oferta
'
,
'
nome
'
],
resultField
:
[
'
university_id
'
,
'
localoffer_id
'
,
'
localoffer_name
'
],
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
cod_curso
'
,
table
:
'
curso_ens_superior
'
},
join
:
{
primary
:
[
'
ano_censo
'
,
'
cod_curso
'
],
foreign
:
[
'
ano_censo
'
,
'
cod_curso
'
],
foreignTable
:
'
curso_ens_superior
'
}
}).
addValue
({
name
:
'
university
'
,
...
...
@@ -270,16 +282,6 @@ rqf.addField({
type
:
'
integer
'
,
field
:
'
cod_organizacao_academica
'
}
}).
addValue
({
name
:
'
capital
'
,
table
:
'
curso_ens_superior
'
,
tableField
:
'
tfd_capital_curso
'
,
resultField
:
'
capital_id
'
,
where
:
{
relation
:
'
=
'
,
type
:
'
integer
'
,
field
:
'
tfd_capital_curso
'
}
}).
addValue
({
name
:
'
course
'
,
table
:
'
curso_ens_superior
'
,
...
...
@@ -416,8 +418,16 @@ courseCountApp.get('/', rqf.parse(), (req, res, next) => {
.
order
(
'
curso_ens_superior.ano_censo
'
)
.
where
(
'
curso_ens_superior.tipo_atributo_ingresso <> 1 OR curso_ens_superior.tipo_atributo_ingresso is NULL
'
)
.
where
(
'
curso_ens_superior.cod_nivel_academico = 1
'
);
}
else
{
}
else
if
(
"
localoffer
"
in
req
.
dims
)
{
req
.
sql
.
from
(
'
curso_ens_superior
'
)
.
field
(
'
curso_ens_superior.ano_censo
'
)
.
field
(
'
COUNT(localoferta_ens_superior.cod_local_oferta)
'
,
'
total
'
)
.
where
(
'
curso_ens_superior.tipo_atributo_ingresso <> 1 OR curso_ens_superior.tipo_atributo_ingresso is NULL
'
)
.
where
(
'
curso_ens_superior.cod_nivel_academico = 1
'
)
.
group
(
'
curso_ens_superior.ano_censo
'
)
.
order
(
'
curso_ens_superior.ano_censo
'
)
.
order
(
'
localoferta_ens_superior.cod_local_oferta
'
);
}
else
{
req
.
sql
.
from
(
'
curso_ens_superior
'
)
.
field
(
'
COUNT(curso_ens_superior.cod_curso)
'
,
'
total
'
)
.
field
(
"
'Brasil'
"
,
'
name
'
)
...
...
@@ -428,6 +438,26 @@ courseCountApp.get('/', rqf.parse(), (req, res, next) => {
.
where
(
'
curso_ens_superior.cod_nivel_academico = 1
'
);
}
next
();
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
addMissing
(
rqf
),
response
(
'
course_count
'
));
},
rqf
.
build
(),
query
,
id2str
.
transform
(),
(
req
,
res
,
next
)
=>
{
if
(
"
localoffer
"
in
req
.
dims
)
{
let
baseq
=
req
.
sql
.
clone
()
let
iesq
=
squel
.
select
()
iesq
.
from
(
'
ies_ens_superior
'
)
.
field
(
'
ies_ens_superior.cod_ies
'
)
.
field
(
'
ies_ens_superior.nome_ies
'
);
req
.
sql
=
squel
.
select
().
from
(
baseq
,
'
bq
'
)
.
field
(
"
'Brasil'
"
,
'
name
'
)
.
field
(
'
ano_censo
'
,
'
year
'
)
.
field
(
'
total
'
)
.
field
(
'
university_id
'
)
.
field
(
'
nome_ies
'
,
'
university_name
'
)
.
field
(
'
localoffer_id
'
)
.
field
(
'
localoffer_name
'
)
.
join
(
iesq
,
'
iq
'
,
'
iq.cod_ies=bq.university_id
'
);
}
next
();
},
query
,
id2str
.
transform
(),
addMissing
(
rqf
),
response
(
'
course_count
'
));
module
.
exports
=
courseCountApp
;
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