Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EMBCESSMOD-4916 - Sync and Removed Pet Food/Care Plans #1953

Merged
merged 2 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions ess/src/API/EMBC.ESS/Resources/Evacuations/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public class NeedsAssessment
public bool? CanProvideIncidentals { get; set; }
public IEnumerable<HouseholdMember> HouseholdMembers { get; set; } = Array.Empty<HouseholdMember>();
public IEnumerable<Pet> Pets { get; set; } = Array.Empty<Pet>();
public bool? HavePetsFood { get; set; }
public NeedsAssessmentType Type { get; set; }
public IEnumerable<Note> Notes { get; set; }
}
Expand Down Expand Up @@ -154,8 +153,7 @@ public class Note

public enum NoteType
{
General,
PetCarePlans
General
}

public enum InsuranceOption
Expand Down
8 changes: 0 additions & 8 deletions ess/src/API/EMBC.ESS/Resources/Evacuations/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public Mappings()
.ForMember(d => d._era_registrant_value, opts => opts.MapFrom(s => s.PrimaryRegistrantId))
.ForMember(d => d._era_evacuatedfromid_value, opts => opts.MapFrom(s => s.EvacuatedFrom.CommunityCode))
.ForMember(d => d.era_era_evacuationfile_era_animal_ESSFileid, opts => opts.MapFrom(s => s.NeedsAssessment.Pets))
.ForMember(d => d.era_haspetfood, opts => opts.MapFrom(s => s.NeedsAssessment.HavePetsFood.HasValue && s.NeedsAssessment.HavePetsFood.Value ? EraTwoOptions.Yes : EraTwoOptions.No))
.ForMember(d => d.era_petcareplans, opts => opts.MapFrom(s => resolveNoteContent(s.NeedsAssessment.Notes.FirstOrDefault(n => n.Type == NoteType.PetCarePlans))))
.ForMember(d => d.era_paperbasedessfile, opts => opts.MapFrom(s => s.ManualFileId))
.ForMember(d => d.era_registrationcompleteddate, opts => opts.MapFrom(s => s.CompletedOn))
.ForMember(d => d.era_interviewername, opts => opts.MapFrom(s => s.CompletedBy))
Expand Down Expand Up @@ -60,12 +58,7 @@ public Mappings()
.ForMember(d => d.HouseholdMembers, opts => opts.MapFrom(s => s.era_era_evacuationfile_era_householdmember_EvacuationFileid))
.ForMember(d => d.Notes, opts => opts.MapFrom(s => s.era_era_evacuationfile_era_essfilenote_ESSFileID))
.ForMember(d => d.Supports, opts => opts.MapFrom(s => s.era_era_evacuationfile_era_evacueesupport_ESSFileId.Select(s => s.era_name)))
.ForPath(d => d.NeedsAssessment.HavePetsFood, opts => opts.MapFrom(s => s.era_haspetfood == (int)EraTwoOptions.Yes))
.ForPath(d => d.NeedsAssessment.Pets, opts => opts.MapFrom(s => s.era_era_evacuationfile_era_animal_ESSFileid))
.ForPath(d => d.NeedsAssessment.Notes, opts => opts.MapFrom(s => new[]
{
string.IsNullOrEmpty(s.era_petcareplans) ? null : new Note { Type = NoteType.PetCarePlans, Content = s.era_petcareplans },
}.Where(n => n != null).ToArray()))
.ForMember(d => d.ManualFileId, opts => opts.MapFrom(s => s.era_paperbasedessfile))
.ForMember(d => d.IsPaper, opts => opts.MapFrom(s => s.era_paperbasedessfile != null))
;
Expand Down Expand Up @@ -109,7 +102,6 @@ public Mappings()
.ForMember(d => d.CanProvideLodging, opts => opts.MapFrom(s => Lookup(s.era_canevacueeprovidelodging)))
.ForMember(d => d.CanProvideTransportation, opts => opts.MapFrom(s => Lookup(s.era_canevacueeprovidetransportation)))
.ForMember(d => d.Insurance, opts => opts.MapFrom(s => Enum.Parse<InsuranceOption>(((InsuranceOptionOptionSet)s.era_insurancecoverage).ToString())))
.ForMember(d => d.HavePetsFood, opts => opts.Ignore())
.ForMember(d => d.HouseholdMembers, opts => opts.MapFrom(s => s.era_era_householdmember_era_needassessment))
.ForMember(d => d.Pets, opts => opts.Ignore())
.ForMember(d => d.Notes, opts => opts.Ignore())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public async Task CanSubmitAnonymousRegistration()
}
},
Insurance = InsuranceOption.Yes,
HavePetsFood = true,
CanProvideClothing = false,
CanProvideFood = true,
CanProvideIncidentals = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public async Task CanUpdateEvacuationFile()
var newUniqueSignature = Guid.NewGuid().ToString().Substring(0, 5);
var needsAssessment = fileToUpdate.NeedsAssessment;

needsAssessment.HavePetsFood = !needsAssessment.HavePetsFood;
foreach (var member in needsAssessment.HouseholdMembers.Where(m => m.LinkedRegistrantId == null && !m.FirstName.Contains("no-registrant")))
{
string originalFirstName = member.FirstName.Substring(member.FirstName.LastIndexOf("_") + 1);
Expand All @@ -172,7 +171,6 @@ public async Task CanUpdateEvacuationFile()
var updatedFile = (await evacuationRepository.Query(new EvacuationFilesQuery { FileId = fileId })).Items.ShouldHaveSingleItem();

var updatedNeedsAssessment = updatedFile.NeedsAssessment;
updatedNeedsAssessment.HavePetsFood.ShouldBe(needsAssessment.HavePetsFood);
foreach (var member in updatedNeedsAssessment.HouseholdMembers.Where(m => !m.IsPrimaryRegistrant && m.LinkedRegistrantId == null && !m.FirstName.Contains("no-registrant")))
{
member.FirstName.ShouldStartWith(newUniqueSignature);
Expand Down Expand Up @@ -221,7 +219,6 @@ public async Task CanMapEvacuationFile()
needsAssessment.CanProvideIncidentals.ShouldBe(originalNeedsAssessment.CanProvideIncidentals);
needsAssessment.CanProvideLodging.ShouldBe(originalNeedsAssessment.CanProvideLodging);
needsAssessment.CanProvideTransportation.ShouldBe(originalNeedsAssessment.CanProvideTransportation);
needsAssessment.HavePetsFood.ShouldBe(originalNeedsAssessment.HavePetsFood);

needsAssessment.HouseholdMembers.Count().ShouldBe(originalNeedsAssessment.HouseholdMembers.Count());
needsAssessment.HouseholdMembers.Where(m => m.IsPrimaryRegistrant).ShouldHaveSingleItem().LinkedRegistrantId.ShouldBe(primaryContact.Id);
Expand Down Expand Up @@ -289,7 +286,6 @@ private EvacuationFile CreateTestFile(Evacuee primaryContact)
},
Type = NeedsAssessmentType.Preliminary,
Insurance = InsuranceOption.Yes,
HavePetsFood = true,
CanProvideClothing = true,
CanProvideFood = true,
CanProvideIncidentals = true,
Expand Down
5 changes: 0 additions & 5 deletions ess/src/API/EMBC.Tests.Integration.ESS/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static EvacuationFile CreateNewTestEvacuationFile(string prefix, Registra
{
Type = NeedsAssessmentType.Preliminary,
Insurance = InsuranceOption.Yes,
HavePetsFood = true,
CanProvideClothing = true,
CanProvideFood = true,
CanProvideIncidentals = true,
Expand Down Expand Up @@ -77,10 +76,6 @@ public static EvacuationFile CreateNewTestEvacuationFile(string prefix, Registra
{
new Pet{ Type = $"{uniqueSignature}_Cat", Quantity = "1" },
new Pet{ Type = $"{uniqueSignature}_Dog", Quantity = "4" }
},
Notes = new[]
{
new Note{ Type = NoteType.PetCarePlans, Content = "pat plans" },
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public class NeedsAssessment
public bool? CanEvacueeProvideIncidentals { get; set; }
public IEnumerable<HouseholdMember> HouseholdMembers { get; set; } = Array.Empty<HouseholdMember>();
public IEnumerable<Pet> Pets { get; set; } = Array.Empty<Pet>();
public bool? HasPetsFood { get; set; }
public NeedsAssessmentType Type { get; set; }
}

Expand Down
2 changes: 0 additions & 2 deletions registrants/src/API/EMBC.Registrants.API/Mappers/Mappings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public Mappings()
.ForMember(d => d.CanProvideClothing, opts => opts.MapFrom(s => s.CanEvacueeProvideClothing))
.ForMember(d => d.CanProvideTransportation, opts => opts.MapFrom(s => s.CanEvacueeProvideTransportation))
.ForMember(d => d.CanProvideIncidentals, opts => opts.MapFrom(s => s.CanEvacueeProvideIncidentals))
.ForMember(d => d.HavePetsFood, opts => opts.MapFrom(s => s.HasPetsFood))
.ForMember(d => d.CompletedBy, opts => opts.Ignore())
;

Expand All @@ -66,7 +65,6 @@ public Mappings()
.ForMember(d => d.CanEvacueeProvideClothing, opts => opts.MapFrom(s => s.CanProvideClothing))
.ForMember(d => d.CanEvacueeProvideTransportation, opts => opts.MapFrom(s => s.CanProvideTransportation))
.ForMember(d => d.CanEvacueeProvideIncidentals, opts => opts.MapFrom(s => s.CanProvideIncidentals))
.ForMember(d => d.HasPetsFood, opts => opts.MapFrom(s => s.HavePetsFood))
;

CreateMap<HouseholdMember, ESS.Shared.Contracts.Events.HouseholdMember>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,10 @@ public class NeedsAssessment
[Required]
public InsuranceOption Insurance { get; set; }

public string? PetCarePlans { get; set; }

[Required]
public IEnumerable<EvacuationFileHouseholdMember> HouseholdMembers { get; set; } = Array.Empty<EvacuationFileHouseholdMember>();

public IEnumerable<Pet> Pets { get; set; } = Array.Empty<Pet>();
public bool? HavePetsFood { get; set; }
public bool? CanProvideFood { get; set; }
public bool? CanProvideLodging { get; set; }
public bool? CanProvideClothing { get; set; }
Expand Down Expand Up @@ -406,10 +403,7 @@ public class Note
public enum NoteType
{
[Description("General")]
General,

[Description("Pet Care Plans")]
PetCarePlans
General
}

/// <summary>
Expand Down Expand Up @@ -547,7 +541,6 @@ public EvacuationFileMapping()
.ForMember(d => d.ModifiedOn, opts => opts.MapFrom(s => s.CompletedOn))
.ForMember(d => d.ReviewingTeamMemberId, opts => opts.MapFrom(s => s.CompletedBy == null ? null : s.CompletedBy.Id))
.ForMember(d => d.ReviewingTeamMemberDisplayName, opts => opts.MapFrom(s => s.CompletedBy == null ? null : s.CompletedBy.DisplayName))
.ForMember(d => d.PetCarePlans, opts => opts.MapFrom(s => s.Notes.SingleOrDefaultProperty(n => n.Type == EMBC.ESS.Shared.Contracts.Events.NoteType.PetCarePlans, n => n.Content)))
;

CreateMap<EvacuationFileHouseholdMember, HouseholdMember>()
Expand Down Expand Up @@ -591,16 +584,6 @@ public class NeedsAssessmentNotesConverter : IValueConverter<NeedsAssessment, IE
public IEnumerable<EMBC.ESS.Shared.Contracts.Events.Note> Convert(NeedsAssessment sourceMember, ResolutionContext context)
{
List<EMBC.ESS.Shared.Contracts.Events.Note> ret = new List<EMBC.ESS.Shared.Contracts.Events.Note>();

if (!string.IsNullOrEmpty(sourceMember.PetCarePlans))
{
ret.Add(new EMBC.ESS.Shared.Contracts.Events.Note
{
Content = sourceMember.PetCarePlans,
Type = EMBC.ESS.Shared.Contracts.Events.NoteType.PetCarePlans,
});
}

return ret;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ private static NeedsAssessment CreateNeedsAssessment()
.RuleFor(o => o.CanProvideIncidentals, f => f.Random.NullableBool())
.RuleFor(o => o.CanProvideLodging, f => f.Random.NullableBool())
.RuleFor(o => o.CanProvideTransportation, f => f.Random.NullableBool())
.RuleFor(o => o.HavePetsFood, f => f.Random.NullableBool())
.RuleFor(o => o.Insurance, f => f.Random.Enum<InsuranceOption>())
.RuleFor(o => o.Type, f => f.Random.Enum<NeedsAssessmentType>())
.RuleFor(o => o.Notes, f => f.Make(f.Random.Int(0, 20), CreateNote))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export { InviteRequest } from './models/invite-request';
export { EvacuationFile } from './models/evacuation-file';
export { NeedsAssessment } from './models/needs-assessment';
export { InsuranceOption } from './models/insurance-option';
export { ReferralServices } from './models/referral-services';
export { EvacuationFileHouseholdMember } from './models/evacuation-file-household-member';
export { HouseholdMemberType } from './models/household-member-type';
export { Pet } from './models/pet';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { EvacuationFileHouseholdMember } from './evacuation-file-household-membe
import { InsuranceOption } from './insurance-option';
import { NeedsAssessmentType } from './needs-assessment-type';
import { Pet } from './pet';
import { ReferralServices } from './referral-services';

/**
* Needs assessment form
Expand All @@ -16,17 +15,11 @@ export interface NeedsAssessment {
canProvideLodging?: null | boolean;
canProvideTransportation?: null | boolean;
createdOn?: null | string;
evacuationExternalReferrals?: null | string;
evacuationImpact?: null | string;
havePetsFood?: null | boolean;
houseHoldRecoveryPlan?: null | string;
householdMembers: Array<EvacuationFileHouseholdMember>;
id?: null | string;
insurance: InsuranceOption;
modifiedOn?: null | string;
petCarePlans?: null | string;
pets?: Array<Pet>;
recommendedReferralServices?: Array<ReferralServices>;
reviewingTeamMemberDisplayName?: null | string;
reviewingTeamMemberId?: null | string;
type?: null | NeedsAssessmentType;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ public class NeedsAssessment
public bool? CanProvideIncidentals { get; set; }
public IEnumerable<HouseholdMember> HouseholdMembers { get; set; } = Array.Empty<HouseholdMember>();
public IEnumerable<Pet> Pets { get; set; } = Array.Empty<Pet>();
public bool? HavePetsFood { get; set; }
public IEnumerable<Note> Notes { get; set; } = Array.Empty<Note>();
}

Expand Down Expand Up @@ -149,8 +148,7 @@ public class Note

public enum NoteType
{
General,
PetCarePlans
General
}

public enum NoteStatus
Expand Down
Loading