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
Harbor Registry
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
82d1c8d0
Commit
82d1c8d0
authored
6 years ago
by
Victor Picussa
Browse files
Options
Downloads
Patches
Plain Diff
[da_merge]Double column doesnt work
parent
858a0048
No related branches found
No related tags found
2 merge requests
!167
[da_merge]Double column doesnt work
,
!164
WIP: Release v1.9.0
Pipeline
#18771
failed
6 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libs/middlewares/query.js
+1
-0
1 addition, 0 deletions
src/libs/middlewares/query.js
src/libs/routes/dailyChargeAmount.js
+29
-5
29 additions, 5 deletions
src/libs/routes/dailyChargeAmount.js
with
30 additions
and
5 deletions
src/libs/middlewares/query.js
+
1
−
0
View file @
82d1c8d0
...
@@ -6,6 +6,7 @@ const db = require(`${libs}/db/query_exec`);
...
@@ -6,6 +6,7 @@ const db = require(`${libs}/db/query_exec`);
function
query
(
req
,
res
,
next
)
{
function
query
(
req
,
res
,
next
)
{
let
sql
=
req
.
sql
.
toParam
();
let
sql
=
req
.
sql
.
toParam
();
log
.
info
(
`Executando query
${
req
.
sql
.
toString
()}
`
);
log
.
info
(
`Executando query
${
req
.
sql
.
toString
()}
`
);
sql
.
text
=
sql
.
text
.
replace
(
/`/g
,
""
);
execute
(
sql
.
text
,
sql
.
values
,
(
err
,
result
)
=>
{
execute
(
sql
.
text
,
sql
.
values
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
log
.
error
(
err
.
stack
);
log
.
error
(
err
.
stack
);
...
...
This diff is collapsed.
Click to expand it.
src/libs/routes/dailyChargeAmount.js
+
29
−
5
View file @
82d1c8d0
...
@@ -284,6 +284,7 @@ rqf.addField({
...
@@ -284,6 +284,7 @@ rqf.addField({
table
:
'
turma
'
,
table
:
'
turma
'
,
tableField
:
'
etapas_mod_ensino_segmento_id
'
,
tableField
:
'
etapas_mod_ensino_segmento_id
'
,
resultField
:
'
education_level_mod_id
'
,
resultField
:
'
education_level_mod_id
'
,
dontGroup
:
true
,
where
:
{
where
:
{
relation
:
'
=
'
,
relation
:
'
=
'
,
type
:
'
integer
'
,
type
:
'
integer
'
,
...
@@ -380,7 +381,7 @@ dailyChargeAmountApp.get('/', rqf.parse(), (req, res, next) => {
...
@@ -380,7 +381,7 @@ dailyChargeAmountApp.get('/', rqf.parse(), (req, res, next) => {
next
();
next
();
},
id2str
.
transform
(),
response
(
'
turma
'
));
},
id2str
.
transform
(),
response
(
'
turma
'
));
dailyChargeAmountApp
.
get
(
'
/average
'
,
rqf
.
parse
(),
(
req
,
res
,
next
)
=>
{
dailyChargeAmountApp
.
get
(
'
/average
'
,
rqf
.
parse
(),
rqf
.
build
(),
(
req
,
res
,
next
)
=>
{
var
status
=
0
;
var
status
=
0
;
if
((
'
education_level_mod
'
in
req
.
filter
||
'
education_level_mod
'
in
req
.
dims
)
if
((
'
education_level_mod
'
in
req
.
filter
||
'
education_level_mod
'
in
req
.
dims
)
&&
(
'
integral_time
'
in
req
.
filter
))
{
&&
(
'
integral_time
'
in
req
.
filter
))
{
...
@@ -401,11 +402,34 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
...
@@ -401,11 +402,34 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
}
}
if
(
status
)
{
if
(
status
)
{
req
.
sql
.
from
(
'
turma
'
)
let
baseQ
=
req
.
sql
.
clone
();
let
tableR
=
baseQ
.
clone
();
tableR
.
from
(
'
turma
'
)
.
field
(
'
duracao_turma
'
)
.
field
(
'
ROW_NUMBER() OVER(PARTITION BY etapas_mod_ensino_segmento_id ORDER BY duracao_turma)
'
,
'
rowno
'
)
.
where
(
'
tipo_turma_id <= 3
'
)
let
tableG
=
baseQ
.
clone
();
tableG
.
from
(
'
turma
'
)
.
field
(
'
1+COUNT(*)
'
,
'
counter
'
)
.
where
(
'
tipo_turma_id <= 3
'
)
.
group
(
'
etapas_mod_ensino_segmento_id
'
)
let
joinRG
=
squel
.
select
();
joinRG
.
from
(
tableR
,
'
R
'
)
.
field
(
'
R.education_level_mod_id
'
)
.
field
(
'
AVG(1.0*R.duracao_turma)/60
'
,
'
median_value
'
)
.
join
(
tableG
,
'
G
'
,
'
R.education_level_mod_id = G.education_level_mod_id AND R.rowNo BETWEEN G.counter/2 AND G.counter/2+G.counter%2
'
)
.
group
(
'
R.education_level_mod_id
'
)
req
.
sql
.
from
(
'
turma
'
)
.
from
(
joinRG
,
'
m
'
)
.
field
(
'
turma.ano_censo
'
,
'
year
'
)
.
field
(
'
turma.ano_censo
'
,
'
year
'
)
.
field
(
'
turma.etapas_mod_ensino_segmento_id
'
,
'
education_level_mod_id
'
)
.
field
(
'
turma.etapas_mod_ensino_segmento_id
'
,
'
education_level_mod_id
'
)
.
field
(
'
AVG(turma.duracao_turma)/60.0
'
,
'
average_class_duration
'
)
.
field
(
'
AVG(turma.duracao_turma)/60.0
'
,
'
average_class_duration
'
)
.
field
(
'
MEDIAN(turma.duracao_turma)/60.0
'
,
'
median_class_duration
'
)
.
field
(
'
AVG(m.median_value)
'
,
'
median_class_duration
'
)
.
field
(
'
STDDEV_SAMP(turma.duracao_turma)/60.0
'
,
'
std_class_duration
'
)
.
field
(
'
STDDEV_SAMP(turma.duracao_turma)/60.0
'
,
'
std_class_duration
'
)
.
field
(
'
QUANTILE(turma.duracao_turma, 0.25)/60.0
'
,
'
fstqt_class_duration
'
)
.
field
(
'
QUANTILE(turma.duracao_turma, 0.25)/60.0
'
,
'
fstqt_class_duration
'
)
.
field
(
'
QUANTILE(turma.duracao_turma, 0.75)/60.0
'
,
'
thdqt_class_duration
'
)
.
field
(
'
QUANTILE(turma.duracao_turma, 0.75)/60.0
'
,
'
thdqt_class_duration
'
)
...
@@ -413,7 +437,7 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
...
@@ -413,7 +437,7 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
.
group
(
'
turma.etapas_mod_ensino_segmento_id
'
)
.
group
(
'
turma.etapas_mod_ensino_segmento_id
'
)
.
order
(
'
turma.ano_censo
'
)
.
order
(
'
turma.ano_censo
'
)
.
order
(
'
turma.etapas_mod_ensino_segmento_id
'
)
.
order
(
'
turma.etapas_mod_ensino_segmento_id
'
)
.
where
(
'
turma.tipo_turma_id <= 3
'
)
.
where
(
'
turma.tipo_turma_id <= 3
and m.education_level_mod_id = turma.etapas_mod_ensino_segmento_id
'
)
}
else
{
}
else
{
res
.
status
(
400
);
res
.
status
(
400
);
next
({
next
({
...
@@ -423,6 +447,6 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
...
@@ -423,6 +447,6 @@ dailyChargeAmountApp.get('/average', rqf.parse(), (req, res, next) => {
}
}
next
();
next
();
},
rqf
.
build
(),
query
,
addMissing
(
rqf
),
id2str
.
transform
(),
response
(
'
turma
'
));
},
query
,
addMissing
(
rqf
),
id2str
.
transform
(),
response
(
'
turma
'
));
module
.
exports
=
dailyChargeAmountApp
;
module
.
exports
=
dailyChargeAmountApp
;
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