Skip to content

Commit bd2b2e2

Browse files
committed
Add transaction to grant update mutation
1 parent 2af1983 commit bd2b2e2

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

backend/api/grants/mutations.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ def send_grant(self, info: Info, input: SendGrantInput) -> SendGrantResult:
290290
return instance
291291

292292
@strawberry.mutation(permission_classes=[IsAuthenticated])
293+
@transaction.atomic
293294
def update_grant(self, info: Info, input: UpdateGrantInput) -> UpdateGrantResult:
294295
request = info.context.request
295296

@@ -306,10 +307,10 @@ def update_grant(self, info: Info, input: UpdateGrantInput) -> UpdateGrantResult
306307
for attr, value in asdict(input).items():
307308
setattr(instance, attr, value)
308309

309-
create_change_admin_log_entry(request.user, instance, "Grant updated")
310-
311310
instance.save()
312311

312+
create_change_admin_log_entry(request.user, instance, "Grant updated")
313+
313314
Participant.objects.update_or_create(
314315
user_id=request.user.id,
315316
conference=instance.conference,

backend/reviews/tests/test_admin.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,8 +717,6 @@ def test_save_review_grants_two_times_does_not_create_duplicate_log_entries(rf,
717717
reimbursement.category for reimbursement in grant_1.reimbursements.all()
718718
} == {ticket_category, travel_category, accommodation_category}
719719

720-
for e in LogEntry.objects.all():
721-
print(e.change_message)
722720
assert LogEntry.objects.count() == 4
723721
assert LogEntry.objects.filter(
724722
user=user,

0 commit comments

Comments
 (0)