mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add functionality to normalize the spots available if over capacity
This commit is contained in:
@@ -48,7 +48,7 @@ export class ChapmanApiBasedParkingRepositoryLoader implements ParkingRepository
|
||||
}
|
||||
}
|
||||
|
||||
private constructIParkingStructureFromJson(jsonStructure: any) {
|
||||
public constructIParkingStructureFromJson(jsonStructure: any) {
|
||||
const structureToReturn: IParkingStructure = {
|
||||
capacity: jsonStructure.Capacity,
|
||||
coordinates: {
|
||||
@@ -57,7 +57,7 @@ export class ChapmanApiBasedParkingRepositoryLoader implements ParkingRepository
|
||||
},
|
||||
id: ChapmanApiBasedParkingRepositoryLoader.generateId(jsonStructure.Address),
|
||||
name: jsonStructure.Name,
|
||||
spotsAvailable: jsonStructure.CurrentCount,
|
||||
spotsAvailable: jsonStructure.CurrentCount > jsonStructure.Capacity ? jsonStructure.Capacity : jsonStructure.CurrentCount,
|
||||
address: jsonStructure.Address
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user