Browse Source

Fix country conversion for unknown

master
Ruben van de Ven 7 months ago
parent
commit
34b7a1c280
  1. 10
      sorteerhoed/HITStore.py

10
sorteerhoed/HITStore.py

@ -181,7 +181,10 @@ class Assignment(Base): @@ -181,7 +181,10 @@ class Assignment(Base):
def toDict(self) -> dict:
values = {c.name: getattr(self, c.name) for c in self.__table__.columns}
if self.turk_country:
values['turk_country_code'] = cc.convert([self.turk_country], to='ISO2')
if self.turk_country == 'Unknown':
values['turk_country_code'] = '--'
else:
values['turk_country_code'] = cc.convert([self.turk_country], to='ISO2')
else:
values['turk_country_code'] = None
return values
@ -192,7 +195,10 @@ class Assignment(Base): @@ -192,7 +195,10 @@ class Assignment(Base):
'turk_country': self.turk_country
}
if self.turk_country:
values['turk_country_code'] = cc.convert([self.turk_country], to='ISO2')
if self.turk_country == 'Unknown':
values['turk_country_code'] = '--'
else:
values['turk_country_code'] = cc.convert([self.turk_country], to='ISO2')
else:
values['turk_country_code'] = None
return values

Loading…
Cancel
Save