Skip to content

Commit

Permalink
Merge pull request #1846 from KyleKayfish/EMBCESSMOD-4753
Browse files Browse the repository at this point in the history
EMBCESSMOD-4753:  Updated conflict detection to ignore spaces in post…
  • Loading branch information
KyleKayfish authored Nov 30, 2023
2 parents d7b88d5 + 57368a3 commit fb24306
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using EMBC.Registrants.API.Controllers;

namespace EMBC.Registrants.API.Services
Expand Down Expand Up @@ -39,7 +40,7 @@ private static bool AddressEquals(this Address address, Address other) =>
(address == null && other == null) ||
(address != null &&
address.AddressLine1.StringSafeEquals(other?.AddressLine1) &&
address.PostalCode.StringSafeEquals(other?.PostalCode) &&
address.PostalCode.RemoveWhitespace().StringSafeEquals(other?.PostalCode.RemoveWhitespace()) &&
address.StateProvince.StringSafeEquals(other?.StateProvince));

private static bool NameEquals(this PersonDetails personDetails, PersonDetails other) =>
Expand All @@ -52,5 +53,11 @@ private static bool DateofBirthEquals(this PersonDetails personDetails, PersonDe

private static bool StringSafeEquals(this string s, string other) =>
string.Equals((s ?? string.Empty).Trim(), (other ?? string.Empty).Trim(), StringComparison.InvariantCultureIgnoreCase);
public static string RemoveWhitespace(this string input)
{
return new string(input.ToCharArray()
.Where(c => !char.IsWhiteSpace(c))
.ToArray());
}
}
}

0 comments on commit fb24306

Please sign in to comment.