From 6050284d4956500181f90efa2a15a6ba3003f50a Mon Sep 17 00:00:00 2001 From: AndyGrant Date: Sat, 21 Jul 2018 20:26:18 -0400 Subject: [PATCH] Fix update on test count when a test is deleted --- OpenBench/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenBench/views.py b/OpenBench/views.py index 8536776..24c1526 100644 --- a/OpenBench/views.py +++ b/OpenBench/views.py @@ -391,6 +391,12 @@ def deleteTest(request, id): test.deleted = True test.save() + # Reduce the test count for the test author + user = User.objects.get(username=test.author) + profile = Profile.objects.get(user=user) + profile.tests -= 1 + profile.save() + # Log the test deltion LogEvent.objects.create( data='Deleted Test',