diff --git a/ess/src/API/EMBC.ESS/Engines/Supporting/SupportProcessing/SelfServeSupportEligibilityStrategy.cs b/ess/src/API/EMBC.ESS/Engines/Supporting/SupportProcessing/SelfServeSupportEligibilityStrategy.cs index 0667e40f4..5842771b9 100644 --- a/ess/src/API/EMBC.ESS/Engines/Supporting/SupportProcessing/SelfServeSupportEligibilityStrategy.cs +++ b/ess/src/API/EMBC.ESS/Engines/Supporting/SupportProcessing/SelfServeSupportEligibilityStrategy.cs @@ -314,6 +314,8 @@ private static SelfServeSupportType MapSupportTypeToSelfServeSupportType(Support private static async Task> GetDuplicateSupportsForHouseholdMember(EssContext ctx, era_householdmember hm, int[] similarSupportTypes, DateTimeOffset eligibleFrom, DateTimeOffset eligibleTo, CancellationToken ct) { + eligibleFrom = eligibleFrom.Date; + eligibleTo = eligibleTo.Date; return await ctx.era_evacueesupports .WhereNotIn(s => s.statuscode.Value, [(int)Resources.Supports.SupportStatus.Cancelled, (int)Resources.Supports.SupportStatus.Void]) .WhereIn(s => s.era_supporttype.Value, similarSupportTypes) diff --git a/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/ComplianceTests.cs b/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/ComplianceTests.cs index 3f1ffde27..c3a0a1015 100644 --- a/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/ComplianceTests.cs +++ b/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/ComplianceTests.cs @@ -30,8 +30,6 @@ public async Task CheckSupportComplianceRequest_OneDuplicate_FlagReturned(Suppor { var fileId = TestData.EvacuationFileId; var householdMembers = TestData.HouseholdMemberIds; - //var initialSupport = new ShelterHotelSupport { FileId = fileId, SupportDelivery = new Referral(), NumberOfNights = 3, NumberOfRooms = 3 }; - //var duplicatedSupport = new ShelterAllowanceSupport { FileId = fileId, SupportDelivery = new Interac(), TotalAmount = 100m }; await DuplicateCheck(fileId, householdMembers, initialSupport, duplicatedSupport, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); } diff --git a/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/SelfServeTests.cs b/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/SelfServeTests.cs index e615c7ca3..9fef8ad0d 100644 --- a/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/SelfServeTests.cs +++ b/ess/src/API/EMBC.Tests.Integration.ESS/Engines/Supporting/SelfServeTests.cs @@ -112,6 +112,20 @@ public async Task ValidateEligibility_DuplicateSupports_False() await RunEligibilityTest(file2.Id, false, "Overlapping supports found"); } + [Fact] + public async Task ValidateEligibility_DuplicateSupportsSameDay_False() + { + var (file1, registrant) = await CreateTestSubjects(taskNumber: TestData.SelfServeActiveTaskId, homeAddress: TestHelper.CreateSelfServeEligibleAddress()); + var previousSupports = new[] + { + new ShelterAllowanceSupport{FileId = file1.Id, From = DateTime.Now.AddHours(-72), To = DateTime.Now.AddMinutes(30), IncludedHouseholdMembers = file1.NeedsAssessment.HouseholdMembers.Select(hm=>hm.Id), SupportDelivery = new Referral() } + }; + await SaveSupports(file1.Id, previousSupports); + + var (file2, _) = await CreateTestSubjects(taskNumber: TestData.SelfServeActiveTaskId, homeAddress: TestHelper.CreateSelfServeEligibleAddress(), existingRegistrant: registrant); + await RunEligibilityTest(file2.Id, false, "Overlapping supports found"); + } + [Fact] public async Task ValidateEligibility_NotDuplicateSupport_True() { @@ -222,8 +236,8 @@ public async Task ValidateEligibility_PreviousOnetimeSupports_TrueWithoutOneTime new ClothingSupport { FileId = file1.Id, - From = DateTime.Now.AddDays(-3).AddHours(-3), - To = DateTime.Now.AddHours(-3), + From = DateTime.Now.AddDays(-4).AddHours(-3), + To = DateTime.Now.AddDays(-1).AddHours(-3), IncludedHouseholdMembers = file1.NeedsAssessment.HouseholdMembers.Select(hm=>hm.Id), SupportDelivery = new Referral() }