Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Aug 22, 2024
1 parent 97ef33d commit 2ca79b1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions onadata/apps/logger/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ def create_or_update_entity(sender, instance, created=False, **kwargs):
).exists()
should_create_or_update = False

if created and not is_review_enabled:
if not is_review_enabled:
should_create_or_update = True

else:
is_review_approved = SubmissionReview.objects.filter(
instance_id=instance.id, status=SubmissionReview.APPROVED
).exists()
should_create_or_update = not is_review_enabled or is_review_approved
if not created:
is_review_approved = SubmissionReview.objects.filter(
instance_id=instance.id, status=SubmissionReview.APPROVED
).exists()
should_create_or_update = is_review_approved

if should_create_or_update:
create_or_update_entity_from_instance(instance)
Expand Down

0 comments on commit 2ca79b1

Please sign in to comment.