Skip to content

Commit

Permalink
fix: viewpoint has no snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Mineau committed Oct 17, 2023
1 parent d82b074 commit 4da3cea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions webhooks/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ def _refresh_bcf(self, save: bool) -> None:
)
except Exception:
viewpoints = []
if len(viewpoints) > 0:
self.notification.payload["topic"]["snapshot_url"] = viewpoints[0][
"snapshot"
]["snapshot_data"]
snapshot_data = next(
(
viewpoint["snapshot"]["snapshot_data"]
for viewpoint in viewpoints
if viewpoint["snapshot"]
),
None,
)
if snapshot_data:
self.notification.payload["topic"]["snapshot_url"] = snapshot_data
if save:
self.notification.save()

Expand Down

0 comments on commit 4da3cea

Please sign in to comment.