Skip to content

Commit

Permalink
fix(collector/warsaw): processing free_places_total of warsaw
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaranski committed Nov 30, 2023
1 parent 5e2161b commit 45d863d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 11 additions & 6 deletions collector/warsaw/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,17 @@ func (s Source) ParkingLots(ctx context.Context) (<-chan map[wheretopark.ID]wher
}

state := wheretopark.State{
LastUpdated: lastUpdate.In(defaultTimezone),
AvailableSpots: map[string]uint{
wheretopark.SpotTypeCarElectric: vendor.FreePlacesTotal.Electric,
wheretopark.SpotTypeCar: vendor.FreePlacesTotal.Public,
wheretopark.SpotTypeCarDisabled: vendor.FreePlacesTotal.Disabled,
},
LastUpdated: lastUpdate.In(defaultTimezone),
AvailableSpots: map[string]uint{},
}
if vendor.FreePlacesTotal.Public > 0 {
state.AvailableSpots[wheretopark.SpotTypeCar] = uint(vendor.FreePlacesTotal.Public)
}
if vendor.FreePlacesTotal.Disabled > 0 {
state.AvailableSpots[wheretopark.SpotTypeCarDisabled] = uint(vendor.FreePlacesTotal.Disabled)
}
if vendor.FreePlacesTotal.Electric > 0 {
state.AvailableSpots[wheretopark.SpotTypeCarElectric] = uint(vendor.FreePlacesTotal.Electric)
}
parkingLots[id] = wheretopark.ParkingLot{
Metadata: metadata,
Expand Down
6 changes: 3 additions & 3 deletions collector/warsaw/vendor.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package warsaw

type FreePlacesTotal struct {
Disabled uint `json:"disabled"`
Public uint `json:"public"`
Electric uint `json:"electric"`
Disabled int `json:"disabled"`
Public int `json:"public"`
Electric int `json:"electric"`
}

type TotalPlaces struct {
Expand Down

0 comments on commit 45d863d

Please sign in to comment.