Skip to content

Commit

Permalink
Comment fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bonk1t committed Jan 2, 2024
1 parent a383dcd commit c82106c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions nalgonda/models/agency_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,15 @@ def load(cls, agency_id: str) -> Optional["AgencyConfig"]:

@classmethod
def load_or_create(cls, agency_id: str) -> "AgencyConfig":
with AgencyConfigFirestoreStorage(agency_id) as config_document:
config_data = config_document.load()
model = cls.load(agency_id)

if not config_data:
if model is None:
config_data = cls._create_default_config()

config_data["agency_id"] = agency_id
model = cls.model_validate(config_data)
config_data["agency_id"] = agency_id
model = cls.model_validate(config_data)

with AgencyConfigFirestoreStorage(agency_id) as config_document:
config_document.save(config_data)
config_document.save(model.model_dump())

return model

Expand Down

0 comments on commit c82106c

Please sign in to comment.