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
Merge requests
!419
[FIX] Updating rate_school_new
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[FIX] Updating rate_school_new
development
into
homologa
Overview
0
Commits
3
Pipelines
0
Changes
1
Merged
Fernando Gbur dos Santos
requested to merge
development
into
homologa
10 months ago
Overview
0
Commits
3
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Compare
homologa
homologa (base)
and
latest version
latest version
3e321f87
3 commits,
10 months ago
1 file
+
41
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/libs/routes_v1/rateSchoolNew.js
+
41
−
12
Options
@@ -308,20 +308,49 @@ rqf.addField({
}
});
// The queries are matched and the total is calculated
function
matchQueries
(
attendsSchoolObj
,
populationObj
)
{
let
match
=
[];
for
(
let
i
=
0
;
i
<
attendsSchoolObj
.
length
;
i
++
)
{
let
newObj
=
attendsSchoolObj
[
i
];
newObj
.
total
=
(
attendsSchoolObj
[
i
].
total
/
populationObj
[
i
].
total
)
*
100
;
/*
The queries are matched and the total is calculated.
This function is necessary to match the results of the
2 queries with the right pair. In some queries, the result
doesn't exist in one of the 2, so, we need to run this algorithm
to match them right.
*/
newObj
.
age_range_id
=
newObj
.
faixa_etaria
;
delete
newObj
.
faixa_etaria
;
function
matchQueries
(
queryPartial
,
queryTotal
)
{
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
;
}
}
match
.
push
(
newObj
);
}
if
(
objMatch
)
{
newObj
.
denominator
=
result
.
total
;
newObj
.
partial
=
objMatch
.
total
;
newObj
.
total
=
(
objMatch
.
total
/
result
.
total
)
*
100
;
match
.
push
(
newObj
);
}
});
return
match
;
}
Loading