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
7f3c3d5f
Commit
7f3c3d5f
authored
10 months ago
by
Fernando Gbur dos Santos
Browse files
Options
Downloads
Patches
Plain Diff
[FIX] Trying to match the 2 queries right
parent
f489d386
No related branches found
No related tags found
3 merge requests
!434
Homologa
,
!419
[FIX] Updating rate_school_new
,
!418
Attendance rate fix
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/routes_v1/rateSchoolNew.js
+41
-12
41 additions, 12 deletions
src/libs/routes_v1/rateSchoolNew.js
with
41 additions
and
12 deletions
src/libs/routes_v1/rateSchoolNew.js
+
41
−
12
View file @
7f3c3d5f
...
@@ -308,20 +308,49 @@ rqf.addField({
...
@@ -308,20 +308,49 @@ rqf.addField({
}
}
});
});
// The queries are matched and the total is calculated
/*
function
matchQueries
(
attendsSchoolObj
,
populationObj
)
{
The queries are matched and the total is calculated.
let
match
=
[];
This function is necessary to match the results of the
2 queries with the right pair. In some queries, the result
for
(
let
i
=
0
;
i
<
attendsSchoolObj
.
length
;
i
++
)
{
doesn't exist in one of the 2, so, we need to run this algorithm
let
newObj
=
attendsSchoolObj
[
i
];
to match them right.
*/
newObj
.
total
=
(
attendsSchoolObj
[
i
].
total
/
populationObj
[
i
].
total
)
*
100
;
newObj
.
age_range_id
=
newObj
.
faixa_etaria
;
function
matchQueries
(
queryTotal
,
queryPartial
)
{
delete
newObj
.
faixa_etaria
;
let
match
=
[];
queryTotal
.
forEach
((
result
)
=>
{
let
newObj
=
{};
let
keys
=
Object
.
keys
(
result
);
keys
.
forEach
((
key
)
=>
{
newObj
[
key
]
=
result
[
key
];
});
let
index
=
keys
.
indexOf
(
'
total
'
);
if
(
index
>
-
1
)
keys
.
splice
(
index
,
1
);
let
objMatch
=
null
;
for
(
let
i
=
0
;
i
<
queryPartial
.
length
;
++
i
)
{
let
partial
=
queryPartial
[
i
];
let
foundMatch
=
true
;
for
(
let
j
=
0
;
j
<
keys
.
length
;
++
j
)
{
let
key
=
keys
[
j
];
if
(
partial
[
key
]
!==
result
[
key
])
{
foundMatch
=
false
;
break
;
}
}
if
(
foundMatch
)
{
objMatch
=
partial
;
break
;
}
}
if
(
objMatch
)
{
newObj
.
denominator
=
result
.
total
;
newObj
.
partial
=
objMatch
.
total
;
newObj
.
total
=
(
objMatch
.
total
/
result
.
total
)
*
100
;
match
.
push
(
newObj
);
match
.
push
(
newObj
);
}
}
});
return
match
;
return
match
;
}
}
...
...
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