Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
front-end
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
front-end
Commits
0a3551c1
Commit
0a3551c1
authored
5 years ago
by
ROBERTO JÚNIOR
Browse files
Options
Downloads
Patches
Plain Diff
Voltando as alterações do commit
88047377
. Para atender a issue 613
parent
312c1451
Branches
Branches containing commit
No related tags found
2 merge requests
!43
Atualizado a página de publicações no simcaq
,
!8
Rs
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/simulator/access-and-offer/collaboration-scheme/services/collaboration-scheme.service.ts
+48
-75
48 additions, 75 deletions
...aboration-scheme/services/collaboration-scheme.service.ts
with
48 additions
and
75 deletions
src/app/simulator/access-and-offer/collaboration-scheme/services/collaboration-scheme.service.ts
+
48
−
75
View file @
0a3551c1
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Observable
}
from
'
rxjs
'
;
import
{
map
,
switchMap
}
from
'
rxjs/operators
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
*
as
_
from
'
lodash
'
;
import
{
Functionality
}
from
'
../../../../shared/entities/functionality/functionality
'
;
...
...
@@ -8,10 +8,12 @@ import { HttpService } from '../../../../shared/services/http/http.service';
import
{
UtilitiesService
}
from
'
../../../../shared/services/utilities/utilities.service
'
;
import
{
CollaborationScheme
}
from
'
../entities/collaboration-scheme
'
;
import
{
CollaborationSchemesByStage
}
from
'
../entities/collaboration-schemes-by-stage
'
;
import
{
SelectLocation
}
from
'
../../../select-location/entities/select-location
'
;
import
{
SessionService
}
from
'
../../../../shared/services/session/session.service
'
;
import
{
AdmDependency
}
from
'
../../../../shared/entities/enums/adm-dependency.enum
'
;
import
{
EnrollmentProjection
}
from
'
../../enrollment-projection/entities/enrollment-projection
'
;
import
{
EnrollmentProjectionByLocation
}
from
'
../../enrollment-projection/entities/enrollment-projection-by-location
'
;
import
{
ViewEnrollmentByStageSeries
}
from
'
../../view-enrollment-by-stage-series/entities/view-enrollment-by-stage-series
'
;
import
{
CurrentYearService
}
from
'
../../../shared/services/current-year/current-year.service
'
;
import
{
NavigableComponentService
}
from
'
../../../shared/entities/base/navigable-component-service
'
;
import
{
SourceInformationEnum
}
from
'
./../../../../shared/entities/enums/source-information.enum
'
;
...
...
@@ -33,8 +35,6 @@ export class CollaborationSchemeService implements NavigableComponentService {
collaborationScheme
.
totalCurrentPublicEnrollment
=
0
;
collaborationScheme
.
totalProposalPublicEnrollment
=
0
;
return
this
.
getEnrollmentT4
().
pipe
(
switchMap
(
enrollmentT4
=>
{
return
this
.
utilitiesService
.
getStages
().
pipe
(
map
(
stages
=>
{
collaborationSchemesByStage
=
stages
.
map
(
stage
=>
new
CollaborationSchemesByStage
({
...
...
@@ -47,27 +47,26 @@ export class CollaborationSchemeService implements NavigableComponentService {
municipalPercentage
:
0
}));
const
resultForEnrollmentProjection
:
EnrollmentProjection
=
this
.
sessionService
.
getItem
<
EnrollmentProjection
>
(
Functionality
.
enrollmentProjection
.
key
);
const
enrollmentOfferYear
:
number
=
this
.
currentYearService
.
getEnrollmentCurrentYear
();
collaborationScheme
.
yearCurrentPublicEnrollment
=
enrollmentOfferYear
;
collaborationScheme
.
yearProposalPublicEnrollment
=
enrollmentOfferYear
+
1
;
const
resultForEnrollmentProjection
:
EnrollmentProjection
=
this
.
sessionService
.
getItem
<
EnrollmentProjection
>
(
Functionality
.
enrollmentProjection
.
key
);
const
resultForViewEnrollmentProjection
:
ViewEnrollmentByStageSeries
=
this
.
sessionService
.
getItem
<
ViewEnrollmentByStageSeries
>
(
Functionality
.
viewEnrollmentByStageAndSeries
.
key
);
const
resultForSelectLocation
:
SelectLocation
=
this
.
sessionService
.
getItem
<
SelectLocation
>
(
Functionality
.
selectLocation
.
key
);
for
(
const
stage
of
stages
)
{
const
collaboration
:
CollaborationSchemesByStage
=
_
.
find
(
collaborationSchemesByStage
,
c
=>
c
.
id
===
stage
.
id
);
const
stagesAdmDependencyLocationEnrollments
=
_
.
filter
(
enrollmentT4
,
s
=>
s
.
education_level_short_id
===
stage
.
id
);
const
enrollmentsByAdmDependencyFederal
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
,
t
=>
t
.
adm_dependency_id
===
AdmDependency
.
Federal
);
const
enrollmentsByAdmDependencyState
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
,
t
=>
t
.
adm_dependency_id
===
AdmDependency
.
State
);
const
enrollmentsByAdmDependencyMunicipal
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
,
t
=>
t
.
adm_dependency_id
===
AdmDependency
.
Municipal
);
const
totalEnrollmentsByAdmDependencyFederal
=
enrollmentsByAdmDependencyFederal
?
enrollmentsByAdmDependencyFederal
.
total
:
0
;
const
totalEnrollmentsByAdmDependencyState
=
enrollmentsByAdmDependencyState
?
enrollmentsByAdmDependencyState
.
total
:
0
;
const
totalEnrollmentsByAdmDependencyMunicipal
=
enrollmentsByAdmDependencyMunicipal
?
enrollmentsByAdmDependencyMunicipal
.
total
:
0
;
const
stagesAdmDependencyLocationEnrollments
=
_
.
find
(
resultForViewEnrollmentProjection
.
stagesAdmDependencyLocationEnrollments
,
s
=>
s
.
id
===
stage
.
id
);
const
totalCurrentPublicEnrollment
=
(
totalEnrollmentsByAdmDependencyFederal
+
totalEnrollmentsByAdmDependencyState
+
totalEnrollmentsByAdmDependencyMunicipal
);
const
totalEnrollmentsByAdmDependencyFederal
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
.
totalEnrollmentsByAdmDependency
,
t
=>
t
.
id
===
AdmDependency
.
Federal
);
const
totalEnrollmentsByAdmDependencyState
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
.
totalEnrollmentsByAdmDependency
,
t
=>
t
.
id
===
AdmDependency
.
State
);
const
totalEnrollmentsByAdmDependencyMunicipal
=
_
.
find
(
stagesAdmDependencyLocationEnrollments
.
totalEnrollmentsByAdmDependency
,
t
=>
t
.
id
===
AdmDependency
.
Municipal
);
const
totalCurrentPublicEnrollment
=
(
totalEnrollmentsByAdmDependencyFederal
.
quantity
+
totalEnrollmentsByAdmDependencyState
.
quantity
+
totalEnrollmentsByAdmDependencyMunicipal
.
quantity
);
if
(
collaboration
)
{
const
enrollmentProjectionByLocation
:
EnrollmentProjectionByLocation
=
_
.
head
(
resultForEnrollmentProjection
.
enrollmentsProjectionsByLocations
);
...
...
@@ -75,15 +74,15 @@ export class CollaborationSchemeService implements NavigableComponentService {
const
stageEnrollment
=
_
.
find
(
enrollmentProjectionByLocation
.
stagesEnrollments
,
r
=>
r
.
id
===
stage
.
id
);
if
(
stageEnrollment
)
{
collaboration
.
numberCurrentPublicEnrollment
=
totalCurrentPublicEnrollment
;
collaboration
.
numberCurrentPublicEnrollment
=
stageEnrollment
.
totalCurrentOffers
;
const
stagesEnrollmentsProposal
=
_
.
find
(
enrollmentProjectionByLocation
.
stagesEnrollments
,
r
=>
r
.
id
===
stage
.
id
);
collaboration
.
numberProposalPublicEnrollment
=
_
.
find
(
stagesEnrollmentsProposal
.
totalEnrollments
,
s
=>
s
.
year
===
collaborationScheme
.
yearProposalPublicEnrollment
).
quantity
;
collaboration
.
federalPercentage
=
((
totalEnrollmentsByAdmDependencyFederal
/
totalCurrentPublicEnrollment
)
*
100
);
collaboration
.
statePercentage
=
((
totalEnrollmentsByAdmDependencyState
/
totalCurrentPublicEnrollment
)
*
100
);
collaboration
.
municipalPercentage
=
((
totalEnrollmentsByAdmDependencyMunicipal
/
totalCurrentPublicEnrollment
)
*
100
);
collaboration
.
federalPercentage
=
((
totalEnrollmentsByAdmDependencyFederal
.
quantity
/
totalCurrentPublicEnrollment
)
*
100
);
collaboration
.
statePercentage
=
((
totalEnrollmentsByAdmDependencyState
.
quantity
/
totalCurrentPublicEnrollment
)
*
100
);
collaboration
.
municipalPercentage
=
((
totalEnrollmentsByAdmDependencyMunicipal
.
quantity
/
totalCurrentPublicEnrollment
)
*
100
);
}
}
...
...
@@ -96,7 +95,6 @@ export class CollaborationSchemeService implements NavigableComponentService {
return
collaborationScheme
;
}));
}));
}
getSourceInformations
():
Array
<
Footnote
>
{
...
...
@@ -113,29 +111,4 @@ export class CollaborationSchemeService implements NavigableComponentService {
}));
return
footNotes
;
}
getEnrollmentT4
():
Observable
<
any
>
{
let
filtersLocation
:
Array
<
string
>
=
new
Array
<
string
>
();
const
enrollmentCurrentYear
:
number
=
this
.
currentYearService
.
getEnrollmentCurrentYear
();
filtersLocation
=
this
.
utilitiesService
.
getSelectLocationFilter
();
let
filters
:
Array
<
string
>
=
new
Array
<
string
>
(
`min_year:"
${
enrollmentCurrentYear
}
"`
,
`max_year:"
${
enrollmentCurrentYear
}
"`
,
`adm_dependency:["1","2","3"]`
);
filters
=
filters
.
concat
(
filtersLocation
);
const
options
:
any
=
this
.
httpService
.
getRequestOptionsWithSearchParams
(
new
Map
<
string
,
string
>
([[
'
filter
'
,
filters
.
join
(
'
,
'
)]]));
return
this
.
httpService
.
getApiEndpoint
().
pipe
(
switchMap
(
apiEndpoint
=>
{
return
this
.
httpService
.
get
<
Array
<
any
>>
(
`
${
apiEndpoint
}
/enrollment?dims=education_level_short,adm_dependency`
,
options
).
pipe
(
map
(
diagnosticT4
=>
diagnosticT4
));
}));
}
}
\ No newline at end of file
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