Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
neophyte57 committed Jun 19, 2024
2 parents cf4636d + 104fc9e commit cbcdc7f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions prime-dotnet-webapi/Services/PlrProviderService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,21 @@ public async Task<IEnumerable<PlrViewModel>> GetMatchingPlrDataAsync(IEnumerable
// Select PlrProviders that match a certification on both college AND license number
.Where(p => _context.CollegeForPlrRoleTypes.Where(rt2c => rt2c.ProviderRoleType == p.ProviderRoleType).Select(rt2c => rt2c.CollegeCode).Contains(cert.CollegeCode)
&& p.CollegeId == cert.LicenseNumber)
.ProjectTo<PlrViewModel>(_mapper.ConfigurationProvider, new { plrRoleTypes, plrStatusReasons })
.ToListAsync();
if (matches.Count > 0)
{
foreach (var match in matches)
{
// Encountering problems with AutoMapper ProjectTo and existing data
PlrViewModel plrViewModel = _mapper.Map<PlrProvider, PlrViewModel>(match);

plrViewModel.ProviderRoleType = await plrRoleTypes.Where(rt => rt.Code == match.ProviderRoleType).Select(rt => rt.Name).SingleAsync();
plrViewModel.StatusReasonCode = await plrStatusReasons.Where(sr => sr.Code == match.StatusReasonCode).Select(rt => rt.Name).SingleAsync();
// 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
match.Expertise = string.Join(", ", _context.Set<PlrExpertise>().Where(e =>
(match.ExpertiseCode != null && match.ExpertiseCode.Contains(e.Code))).Select(e => e.Name));
plrProviders.Add(match);
plrViewModel.Expertise = string.Join(", ", _context.Set<PlrExpertise>().Where(e =>
plrViewModel.ExpertiseCode != null && plrViewModel.ExpertiseCode.Contains(e.Code)).Select(e => e.Name));

plrProviders.Add(plrViewModel);
}
}
}
Expand Down

0 comments on commit cbcdc7f

Please sign in to comment.