Skip to content

Commit

Permalink
Flip the logic of the further establishments search
Browse files Browse the repository at this point in the history
This is to improve the mutation score and improve readibility
  • Loading branch information
nwarms committed Dec 20, 2024
1 parent 3bf1384 commit 4622416
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,11 @@ await academiesDbContext.EstablishmentsFiat
ConvertStringToSafeguardingScore(me.PreviousSafeguardingIsEffective),
me.PreviousInspectionStartDate.ParseAsNullableDate())))
.ToListAsync();

// Look in MisFurtherEducationEstablishments for academies not found in MisEstablishments
// Check to see if all ratings have been found in MisEstablishments, if not search in MisFurtherEducationEstablishments
// Note: if an entry is in MisEstablishments then it will not be in MisFurtherEducationEstablishments, even if it has no ofsted data
var urnsNotInMisEstablishments = urns.Except(ofstedRatings.Select(a => a.Urn)).ToArray();
if (urnsNotInMisEstablishments.Length > 0)
if (urns.Length != ofstedRatings.Count)
{
var urnsNotInMisEstablishments = urns.Except(ofstedRatings.Select(a => a.Urn)).ToArray();
ofstedRatings.AddRange(
await academiesDbContext.FurtherEducationEstablishmentsFiat
.Where(mfe => urnsNotInMisEstablishments.Contains(mfe.ProviderUrn))
Expand Down

0 comments on commit 4622416

Please sign in to comment.