From ba4d6d35c445e10df2d4b6bad213215055bb25b1 Mon Sep 17 00:00:00 2001 From: nevisson <nevisson@gmail.com> Date: Sat, 13 Jul 2019 16:39:39 -0300 Subject: [PATCH] =?UTF-8?q?Ajustes=20para=20n=C3=A3o=20consultar=20rota=20?= =?UTF-8?q?no=20PQR=20da=20carreira=20de=20professor.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/simulator/pqr/services/pqr.service.ts | 2 +- ...eer-and-remuneration-teachers.component.ts | 14 +++++----- ...areer-and-remuneration-teachers.service.ts | 27 ++++++++++--------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/src/app/simulator/pqr/services/pqr.service.ts b/src/app/simulator/pqr/services/pqr.service.ts index 7ad3c9a0..ef860aa8 100644 --- a/src/app/simulator/pqr/services/pqr.service.ts +++ b/src/app/simulator/pqr/services/pqr.service.ts @@ -85,7 +85,7 @@ export class PqrService { return this.workJourneyTeacherService.getData(); case CareerAndRemunerationTeachersComponent: - return this.careerAndRemunerationTeachersService.getData(); + return this.careerAndRemunerationTeachersService.getData(true); case InfrastructureSchoolBuildingsComponent: return this.infrastructureSchoolBuildingsService.getData(true); diff --git a/src/app/simulator/quality-conditions/career-and-remuneration-teachers/career-and-remuneration-teachers.component.ts b/src/app/simulator/quality-conditions/career-and-remuneration-teachers/career-and-remuneration-teachers.component.ts index 6978dfab..ed9928af 100644 --- a/src/app/simulator/quality-conditions/career-and-remuneration-teachers/career-and-remuneration-teachers.component.ts +++ b/src/app/simulator/quality-conditions/career-and-remuneration-teachers/career-and-remuneration-teachers.component.ts @@ -39,7 +39,7 @@ export class CareerAndRemunerationTeachersComponent extends BaseNavigableCompone } processData(): Observable<CareerAndRemunerationTeachers> { - return this.careerAndRemunerationTeachersService.getData(); + return this.careerAndRemunerationTeachersService.getData(this.pqrMode); } processSessionData(sessionData: CareerAndRemunerationTeachers): void { @@ -68,11 +68,13 @@ export class CareerAndRemunerationTeachersComponent extends BaseNavigableCompone } ngDoCheck(): void { - if (this.data.teacherFormationLevels && this.data.teacherFormationLevels.levels.length > 0) { - if (this.data.teacherFormationLevels.levels[0].diagnostic !== undefined) { - if (!_.isEqual(this.data.teacherFormationLevels.levels, this.prevTeacherFormationLevels)) { - this.careerAndRemunerationTeachersService.processTotals(this.data); - this.prevTeacherFormationLevels = _.cloneDeep(this.data.teacherFormationLevels.levels); + if (!this.pqrMode) { + if (this.data.teacherFormationLevels && this.data.teacherFormationLevels.levels.length > 0) { + if (this.data.teacherFormationLevels.levels[0].diagnostic !== undefined) { + if (!_.isEqual(this.data.teacherFormationLevels.levels, this.prevTeacherFormationLevels)) { + this.careerAndRemunerationTeachersService.processTotals(this.data); + this.prevTeacherFormationLevels = _.cloneDeep(this.data.teacherFormationLevels.levels); + } } } } diff --git a/src/app/simulator/quality-conditions/career-and-remuneration-teachers/services/career-and-remuneration-teachers.service.ts b/src/app/simulator/quality-conditions/career-and-remuneration-teachers/services/career-and-remuneration-teachers.service.ts index 0147ee56..d47cabb5 100644 --- a/src/app/simulator/quality-conditions/career-and-remuneration-teachers/services/career-and-remuneration-teachers.service.ts +++ b/src/app/simulator/quality-conditions/career-and-remuneration-teachers/services/career-and-remuneration-teachers.service.ts @@ -27,7 +27,7 @@ export class CareerAndRemunerationTeachersService implements NavigableComponentS constructor(private httpService: HttpService, private utilitiesService: UtilitiesService, private sessionService: SessionService, private currentYearService: CurrentYearService) { } - getData(): Observable<CareerAndRemunerationTeachers> { + getData(pqrMode: boolean = false): Observable<CareerAndRemunerationTeachers> { const simulationYears = this.getSimulationYears(); const careerAndRemunerationTeachers: CareerAndRemunerationTeachers = new CareerAndRemunerationTeachers({ years: simulationYears }); @@ -49,11 +49,15 @@ export class CareerAndRemunerationTeachersService implements NavigableComponentS } careerAndRemunerationTeachers.teacherFormationLevels = teacherFormationLevels; - return this.getDiagnostic().pipe( - map((diagnostics) => { - this.setPercTeacherDistributionCareerLevel(careerAndRemunerationTeachers, diagnostics); - return careerAndRemunerationTeachers; - })); + if (!pqrMode) { + return this.getDiagnostic().pipe( + map((diagnostics) => { + this.setPercTeacherDistributionCareerLevel(careerAndRemunerationTeachers, diagnostics); + return careerAndRemunerationTeachers; + })); + } else { + return of(careerAndRemunerationTeachers); + } })); })); } @@ -125,7 +129,7 @@ export class CareerAndRemunerationTeachersService implements NavigableComponentS const totalPercentageOfYear: number = this.utilitiesService.roundNumber((teacherFormationLevelOfYear.percTeacherDistributionCareerLevel.map((percDistributionLevel: TeacherDistributionCareerLevel) => percDistributionLevel.percentage).reduce((a, b) => { - return b ? a + b : a; + return a + b; })), 2); careerAndRemunerationTeachers.totals.push(new TeacherDistributionCareerLevel({ year: year, percentage: totalPercentageOfYear * 1e0 / 1e0 })); @@ -261,9 +265,9 @@ export class CareerAndRemunerationTeachersService implements NavigableComponentS const yearsSimulation: Array<number> = this.utilitiesService.getSimulationYears(); for (let i = 0; i < data.teacherFormationLevels.levels.length; i++) { - data.teacherFormationLevels.levels[i].diagnostic = undefined; + data.teacherFormationLevels.levels[i].diagnostic = 0; data.teacherFormationLevels.levels[i].percTeacherDistributionCareerLevel = yearsSimulation.map(yearSimulation => - new TeacherDistributionCareerLevel({ year: yearSimulation, percentage: undefined })); + new TeacherDistributionCareerLevel({ year: yearSimulation, percentage: 0 })); } } @@ -275,14 +279,13 @@ export class CareerAndRemunerationTeachersService implements NavigableComponentS const totalPercentageOfYear: number = this.utilitiesService.roundNumber(((teacherFormationLevelOfYear.percTeacherDistributionCareerLevel.map((percDistributionLevel: TeacherDistributionCareerLevel) => percDistributionLevel.percentage).reduce((a, b) => { - return b ? a + b : a; + return a + b; }))), 2); if (totalPercentageOfYear !== 100) { let formation = _.find(careerAndRemunerationTeachers.teacherFormationLevels.levels, l => l.formationLevel.id === FormationLevelEnum.Superior); - - if (formation === undefined || formation === null) { + if (formation.diagnostic === 0) { formation = _.find(careerAndRemunerationTeachers.teacherFormationLevels.levels, l => l.formationLevel.id === FormationLevelEnum.Medio); } -- GitLab