Skip to content

Commit edf3480

Browse files
authored
Merge pull request #363 from bcgov/P900_Update
updated schoolspace ratio in p900
2 parents 733031e + 726fb47 commit edf3480

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

OFM.Infrastructure.WebAPI/Services/Processes/LicenceDetail/P900CalculateLicenceTotal.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class P900CalculateLicenceTotal(ID365AppUserService appUserService, ID365
3333
private decimal Total_Three_to_Five;
3434
private decimal Total_Under_Three;
3535
private decimal Total_Star_Percentage;
36+
private decimal School_Space_Ratio;
3637
public short ProcessId => Setup.Process.LicenceDetailRecords.CalculateLicenceTotal;
3738
public string ProcessName => Setup.Process.LicenceDetailRecords.CalculteLicenceTotalName;
3839

@@ -252,7 +253,9 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
252253
if (Total_Operational_Spaces != 0)
253254
{
254255
Total_Star_Percentage = Math.Round((Total_Under_Three + Total_Three_to_Five) / Total_Operational_Spaces * 100, 0, MidpointRounding.AwayFromZero);
255-
}
256+
School_Space_Ratio = Math.Round((decimal)licensecategorygroup.Where(type => type.LicenceCategoryName.Contains("Group Child Care (School-Age)")).Sum(x => x.OperationalSpacespercategory) / Total_Operational_Spaces,2, MidpointRounding.AwayFromZero);
257+
258+
}
256259
else
257260
{
258261
_logger.LogError("Total_Operational_Spaces is null or zero. Cannot compute percentage.");
@@ -269,6 +272,7 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
269272
{"ofm_family_child_care_op", (int)licensecategorygroup.Where(type=>type.LicenceCategoryName.Contains("Family Child Care")).Sum(x=>x.OperationalSpacespercategory) },
270273
{"ofm_group_child_care_school_age_op",(int)licensecategorygroup.Where(type=>type.LicenceCategoryName.Contains("Group Child Care (School-Age)")).Sum(x=>x.OperationalSpacespercategory)},
271274
{"ofm_star_total_percentage",Total_Star_Percentage},
275+
{"ofm_school_age_spaces_ratio",School_Space_Ratio}
272276
};
273277
var serializedApplicationRecord = JsonSerializer.Serialize(updateApplicationRecord);
274278
var updateApplicationResult = await d365WebApiService.SendPatchRequestAsync(_appUserService.AZSystemAppUser, $"ofm_applications({_processParams.Application.applicationId})", serializedApplicationRecord);

0 commit comments

Comments
 (0)