Skip to content

Commit

Permalink
feature: verify widget type
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanJaeger committed Nov 19, 2024
1 parent 177e02b commit 2659870
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions insights/widgets/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ def update(self, request, *args, **kwargs):
config.update(update_data["config"])
update_data["config"] = config

if widget.type != "card":
if widget.type != "card" or widget.type != "recurrence":
serializer = self._update(widget, update_data, partial)
return Response(serializer.data)

if config.get("operation") != "recurrence" and widget.type != "recurrence":
if config.get("operation") != "recurrence":
try:
widget.report.delete()
except Report.DoesNotExist:
Expand All @@ -47,6 +47,10 @@ def update(self, request, *args, **kwargs):
return Response(serializer.data)

config["limit"] = 1

if widget.type == "recurrence":
config["limit"] = 5

serializer = self._update(widget, update_data, partial)
widget.refresh_from_db()
try:
Expand Down

0 comments on commit 2659870

Please sign in to comment.