refactoring

This commit is contained in:
cja committed 2025-05-28 13:27:11 +03:00
1 parent ecd2ad4602
commit efa167d4d4
1 file changed
+2 -4
+2 -4
View File
@@ -64,7 +64,7 @@ class GetTests(generics.ListAPIView):
"""Returns a QuerySet of tests filtered by status for a given user."""
print(status)
if status is None:
return Test.objects.all().order_by('dateend')
return Test.objects.all()
status_filters = {
'active' : Test.objects.filter(
@@ -77,7 +77,7 @@ class GetTests(generics.ListAPIView):
testing__completion_date__lt=now
).distinct()
}
return status_filters.get(status, Test.objects.none()).order_by('dateend')
return status_filters.get(status, Test.objects.none())
def set_attemps_number(self, user, tests):
"""Updates the number of attempts remaining for each test for the user."""
@@ -146,8 +146,6 @@ class TestCreate(APIView):
file=test_image,
name=request.data["name"],
description=request.data["description"],
datestart=request.data["datestart"],
dateend=request.data["dateend"],
author=user,
pass_perc=request.data["pass_perc"],
time=request.data["time"],