Skip to content

Commit

Permalink
Merge pull request #2263 from ytqsl/release/R3.2.0
Browse files Browse the repository at this point in the history
EMBCESSMOD-5485: changed overlapping supports checks to be for the entire day
  • Loading branch information
ytqsl authored May 31, 2024
2 parents 133d2fd + f09af73 commit e4dce7c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ private static SelfServeSupportType MapSupportTypeToSelfServeSupportType(Support

private static async Task<IEnumerable<era_evacueesupport>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit e4dce7c

Please sign in to comment.