Skip to content

Commit

Permalink
Merge pull request #1819 from KyleKayfish/EMBCESSMOD-4653_2
Browse files Browse the repository at this point in the history
EMBCESSMOD-4563:  Updated Support duplicate check to consider FoodGro…
  • Loading branch information
KyleKayfish authored Sep 5, 2023
2 parents 463f268 + 1e24e71 commit b1c531b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,26 @@ public async Task<IEnumerable<SupportFlag>> CheckCompliance(Support support)
var type = checkedSupport.era_supporttype.Value;
var householdMembers = checkedSupport.era_era_householdmember_era_evacueesupport.ToList();

var similarSupports = (await ((DataServiceQuery<era_evacueesupport>)ctx.era_evacueesupports.Where(s =>
var similarSupports = new List<era_evacueesupport>();

//EMBCESSMOD-4653 - treat 'Food - Groceries' and 'Food - Restaurant Meals' as the same support type
if (type == (int)SupportType.Food_Groceries ||
type == (int)SupportType.Food_Restaurant)
{
similarSupports = (await ((DataServiceQuery<era_evacueesupport>)ctx.era_evacueesupports.Where(s =>
s.era_name != checkedSupport.era_name && (s.era_supporttype == (int)SupportType.Food_Groceries || s.era_supporttype == (int)SupportType.Food_Restaurant) &&
s.statuscode != (int)Resources.Supports.SupportStatus.Cancelled && s.statuscode != (int)Resources.Supports.SupportStatus.Void &&
((s.era_validfrom >= from && s.era_validfrom <= to) || (s.era_validto >= from && s.era_validto <= to) || (s.era_validfrom < from && s.era_validto > to))))
.GetAllPagesAsync()).ToList();
}
else
{
similarSupports = (await ((DataServiceQuery<era_evacueesupport>)ctx.era_evacueesupports.Where(s =>
s.era_name != checkedSupport.era_name && s.era_supporttype == type &&
s.statuscode != (int)Resources.Supports.SupportStatus.Cancelled && s.statuscode != (int)Resources.Supports.SupportStatus.Void &&
((s.era_validfrom >= from && s.era_validfrom <= to) || (s.era_validto >= from && s.era_validto <= to) || (s.era_validfrom < from && s.era_validto > to))))
.GetAllPagesAsync()).ToList();
}

similarSupports.AsParallel().ForAll(s =>
{
Expand Down
15 changes: 15 additions & 0 deletions shared/src/EMBC.ESS.Shared.Contracts/Events/Supports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@ public abstract class Support
public IEnumerable<SupportFlag> Flags { get; set; } = Array.Empty<SupportFlag>();
}

public enum SupportType
{
#pragma warning disable CA1707 // Identifiers should not contain underscores
Food_Groceries = 174360000,
Food_Restaurant = 174360001,
Lodging_Hotel = 174360002,
Lodging_Billeting = 174360003,
Lodging_Group = 174360004,
Incidentals = 174360005,
Clothing = 174360006,
Transportation_Taxi = 174360007,
Transportation_Other = 174360008,
#pragma warning restore CA1707 // Identifiers should not contain underscores
}

[JsonConverter(typeof(PolymorphicJsonConverter<SupportDelivery>))]
public abstract class SupportDelivery
{
Expand Down

0 comments on commit b1c531b

Please sign in to comment.