Commit 14a78200 authored by Marc-Andre Santune's avatar Marc-Andre Santune
Browse files

Handle case where operation history was not already defined before

parent e71616f5
......@@ -68,12 +68,19 @@ class BuildingGeneric:
def update_status_history(self, status: str) -> None:
"""
update the history
Update the history.
Note: the retries for conflict error are managed within BKC API
"""
if self._building.get("operation_history") is None:
operation_history = [status] # Init the history if did not already exist
else:
operation_history = [*self._building.get("operation_history"), status]
payload = {
"operation_history": [*self._building.get("operation_history"), status]
"operation_history": operation_history
}
self._req("put", join(self.settings.base_url, self._uid), json={**payload})
def register_error_for_building(self, error_code: str):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment