Aug 17 - Update for customer inspector contract scope
This commit is contained in:
@@ -1089,11 +1089,19 @@ struct StandaloneIssueView: View {
|
||||
}
|
||||
private var remainingSlots: Int { maxPhotos - photos.count }
|
||||
|
||||
/// Facilities this user may file a new issue against.
|
||||
/// Excludes rows SyncManager retained purely so an unsynced draft could
|
||||
/// still show its facility name — see StartInspectionView for the full
|
||||
/// explanation. Out-of-scope facilities must not be offered for new work.
|
||||
private var availableFacilities: [LocalFacility] {
|
||||
facilities.filter { $0.isActive }
|
||||
}
|
||||
|
||||
/// Unique contracts derived from cached facilities, sorted by name.
|
||||
private var contracts: [(id: Int, name: String)] {
|
||||
var seen = Set<Int>()
|
||||
var result: [(id: Int, name: String)] = []
|
||||
for f in facilities {
|
||||
for f in availableFacilities {
|
||||
if seen.insert(f.projectId).inserted {
|
||||
result.append((id: f.projectId, name: f.projectName))
|
||||
}
|
||||
@@ -1106,7 +1114,7 @@ struct StandaloneIssueView: View {
|
||||
private var filteredFacilities: [LocalFacility] {
|
||||
guard let pid = selectedProjectId else { return [] }
|
||||
var seen = Set<Int>()
|
||||
return facilities
|
||||
return availableFacilities
|
||||
.filter { $0.projectId == pid }
|
||||
.filter { seen.insert($0.serverId).inserted }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user