Skip to content

Commit

Permalink
Merge pull request #89 from ParkenDD/source-name-updates
Browse files Browse the repository at this point in the history
Source name updates at pull converters
  • Loading branch information
the-infinity authored Feb 9, 2024
2 parents 771db69 + aad116f commit 23bf821
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ def update_source_static(self, source_uid: str):
if source_uid not in self.pull_converters and source_uid not in self.legacy_pull_converters:
raise ConverterMissingException(f'converter {source_uid} is missing')

try:
source = self.source_repository.fetch_source_by_uid(source_uid)
except ObjectNotFoundException:
source = self._create_source(source_uid)
source = self._get_upserted_source(source_uid)

try:
if source_uid in self.legacy_pull_converters:
Expand Down Expand Up @@ -204,14 +201,19 @@ def _legacy_update_parking_site_static(self, source: Source, lot_info: LotInfo):
self.import_mapper.map_lot_info_to_parking_site(lot_info_input, parking_site)
self.parking_site_repository.save_parking_site(parking_site)

def _create_source(self, source_uid: str) -> Source:
source = Source()
source.uid = source_uid
def _get_upserted_source(self, source_uid: str) -> Source:
try:
source = self.source_repository.fetch_source_by_uid(source_uid)
except ObjectNotFoundException:
source = Source()
source.uid = source_uid

if source_uid in self.legacy_pull_converters:
source_info = self.legacy_pull_converters[source_uid].POOL
else:
source_info = self.pull_converters[source_uid].source_info
for key in [
'name',
'public_url',
'attribution_license',
'attribution_url',
Expand Down

0 comments on commit 23bf821

Please sign in to comment.