05/21 Fix issue's photo problems

This commit is contained in:
Nguyen Ngo
2026-05-21 13:24:10 -04:00
parent 437ed913cd
commit 6aa3b74e61
8 changed files with 602 additions and 103 deletions
@@ -46,10 +46,15 @@ struct StartInspectionView: View {
return result.sorted { $0.name < $1.name }
}
/// Facilities that belong to the selected contract.
/// Facilities that belong to the selected contract, deduplicated by serverId.
/// Guards against duplicate LocalFacility records if the server ever returns
/// the same facility id more than once in the /api/v1/facilities response.
private var filteredFacilities: [LocalFacility] {
guard let pid = selectedProjectId else { return [] }
return facilities.filter { $0.projectId == pid }
var seen = Set<Int>()
return facilities
.filter { $0.projectId == pid }
.filter { seen.insert($0.serverId).inserted }
}
private var selectedFacility: LocalFacility? {