Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix so that no expertise code in PLR record doesn't cause error #1744

Merged
merged 10 commits into from
Nov 10, 2021
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { map } from 'rxjs/operators';
import { forkJoin } from 'rxjs';
import { catchError, exhaustMap, map } from 'rxjs/operators';
import { forkJoin, of } from 'rxjs';

import { PermissionService } from '@auth/shared/services/permission.service';
import { ToastService } from '@core/services/toast.service';
Expand Down Expand Up @@ -75,14 +75,10 @@ export class EnrolleeOverviewComponent extends AdjudicationContainerComponent im
.subscribe((enrollee: HttpEnrollee) => this.enrollee = enrollee);

this.paperEnrolmentResource.getAdjudicationDocuments(+this.route.snapshot.params.id)
.subscribe(documents => {
this.documents = documents
});
.subscribe(documents => this.documents = documents);

this.enrolmentResource.getCurrentEnrolleeAbsence(+this.route.snapshot.params.id)
.subscribe((absence: EnrolleeAbsence) => {
this.absence = absence
});
.subscribe((absence: EnrolleeAbsence) => this.absence = absence);
}

private loadEnrollee(enrolleeId: number): void {
Expand All @@ -97,18 +93,25 @@ export class EnrolleeOverviewComponent extends AdjudicationContainerComponent im
}))
),
enrolleeNavigation: this.adjudicationResource.getAdjacentEnrolleeId(enrolleeId),
plrInfo: this.adjudicationResource.getPlrInfoByEnrolleeId(enrolleeId)
})
.subscribe(({ enrollee, enrolleeNavigation, plrInfo }) => {
this.enrollee = enrollee.enrollee;
this.enrollees = [enrollee.enrolleeView];
this.enrolment = enrollee.enrolment;
this.enrolleeNavigation = enrolleeNavigation;
this.plrInfo = plrInfo;
// hide the adjudication card if enrolment is editable and no 'reason for adjudication'
this.showAdjudication = !(enrollee.enrollee.currentStatus.statusCode === EnrolmentStatusEnum.EDITABLE
&& !enrollee.enrollee.currentStatus.enrolmentStatusReasons?.length);
});
}).pipe(
map(
({ enrollee, enrolleeNavigation }) => {
// Complete this first before attempting to get PLR info, so user can see information rendered sooner
this.enrollee = enrollee.enrollee;
this.enrollees = [enrollee.enrolleeView];
this.enrolment = enrollee.enrolment;
this.enrolleeNavigation = enrolleeNavigation;
// hide the adjudication card if enrolment is editable and no 'reason for adjudication'
this.showAdjudication = !(enrollee.enrollee.currentStatus.statusCode === EnrolmentStatusEnum.EDITABLE
&& !enrollee.enrollee.currentStatus.enrolmentStatusReasons?.length);
return enrolleeId;
}
),
exhaustMap((enrolleeId: number) => this.adjudicationResource.getPlrInfoByEnrolleeId(enrolleeId)
.pipe(
map((plrInfo: PlrInfo[]) => this.plrInfo = plrInfo),
catchError(_ => of([]))))
).subscribe();
}

private enrolmentAdapter(enrollee: HttpEnrollee): Enrolment {
Expand Down
4 changes: 3 additions & 1 deletion prime-dotnet-webapi/Services/PlrProviderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,12 @@ public async Task<IEnumerable<PlrViewModel>> GetPlrDataByCollegeIdsAsync(IEnumer
.ProjectTo<PlrViewModel>(_mapper.ConfigurationProvider, new { plrRoleTypes, plrStatusReasons })
.ToListAsync();

// If a PlrViewModel has ExpertiseCodes, translate the codes to human-readable text
// PlrProvider's Expertise array does not play well with automapper ProjectTo, map manually before return
return plr.Select(p =>
{
p.Expertise = string.Join(", ", _context.Set<PlrExpertise>().Where(e => p.ExpertiseCode.Contains(e.Code)).Select(e => e.Name));
p.Expertise = string.Join(", ", _context.Set<PlrExpertise>().Where(e =>
(p.ExpertiseCode != null && p.ExpertiseCode.Contains(e.Code))).Select(e => e.Name));
james-hollinger marked this conversation as resolved.
Show resolved Hide resolved
return p;
});
}
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion utilities/PlrIntakeUtility/PlrIntakeUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
Expand Down