Skip to content

Commit

Permalink
Merge pull request #63 from mobidata-bw/better-datex-mapping
Browse files Browse the repository at this point in the history
better datex mapping
  • Loading branch information
the-infinity authored Dec 22, 2023
2 parents fed1bb5 + 3801780 commit 7f58f79
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webapp/public_rest_api/datex2/datex2_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ def map_parking_site(self, parking_site: ParkingSite) -> Datex2ParkingSite:
),
)

if parking_site.realtime_free_capacity is not None:
datex2_parking_site.availableSpaces = parking_site.realtime_free_capacity

if parking_site.realtime_capacity is not None:
datex2_parking_site.availableSpaces = parking_site.realtime_capacity
else:
datex2_parking_site.availableSpaces = parking_site.capacity

if parking_site.realtime_opening_status == OpeningStatus.OPEN:
datex2_parking_site.isOpenNow = True
Expand All @@ -49,7 +54,6 @@ def map_parking_site(self, parking_site: ParkingSite) -> Datex2ParkingSite:
'modified': 'lastUpdate',
'max_stay': 'maximumParkingDuration',
'name': 'name',
'capacity': 'numberOfSpaces',
'fee_description': 'tariffDescription',
'public_url': 'urlLinkAddress',
}
Expand Down

0 comments on commit 7f58f79

Please sign in to comment.