Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4716 from corona-warn-app/fix/13747-Update-Groupi…
Browse files Browse the repository at this point in the history
…ng-logic-for-the-new-DCC-Schema

 update grouping logic to support the new rules
  • Loading branch information
30mar authored Aug 10, 2022
2 parents ee273e0 + 52f9071 commit 00184b5
Show file tree
Hide file tree
Showing 3 changed files with 697 additions and 602 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,16 @@ final class HealthCertificate: Codable, Equatable, Comparable, RecycleBinIdentif
// This covers scenarios where familyName and givenName were swapped.
let hasCrossIntersection_FamilyName_GivenName = familyNameComponents.intersection(other.givenNameComponents).isNotEmpty
let hasCrossIntersection_GivenName_FamilyName = givenNameComponents.intersection(other.familyNameComponents).isNotEmpty
let hasCrossNameIntersections = hasCrossIntersection_FamilyName_GivenName && hasCrossIntersection_GivenName_FamilyName

let hasCrossNameIntersectionWithOneEmptyName: Bool
if givenNameComponents.isEmpty && other.familyNameComponents.isEmpty {
hasCrossNameIntersectionWithOneEmptyName = familyNameComponents.intersection(other.givenNameComponents).isNotEmpty
} else if familyNameComponents.isEmpty && other.givenNameComponents.isEmpty {
hasCrossNameIntersectionWithOneEmptyName = givenNameComponents.intersection(other.familyNameComponents).isNotEmpty
} else {
hasCrossNameIntersectionWithOneEmptyName = false
}
let hasCrossNameIntersections = hasCrossNameIntersectionWithOneEmptyName || (hasCrossIntersection_FamilyName_GivenName && hasCrossIntersection_GivenName_FamilyName)

return hasNameIntersections || hasCrossNameIntersections
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class HealthCertificate_BelongsToSamePersonTests: XCTestCase {
}

private struct TesCaseName: Decodable {
let gnt: String
let fnt: String
let gnt: String?
let fnt: String?
}
}
Loading

0 comments on commit 00184b5

Please sign in to comment.