refactoring
This commit is contained in:
1 parent
ecd2ad4602
commit
efa167d4d4
1 file changed
+2
-4
@@ -64,7 +64,7 @@ class GetTests(generics.ListAPIView):
|
|||||||
"""Returns a QuerySet of tests filtered by status for a given user."""
|
"""Returns a QuerySet of tests filtered by status for a given user."""
|
||||||
print(status)
|
print(status)
|
||||||
if status is None:
|
if status is None:
|
||||||
return Test.objects.all().order_by('dateend')
|
return Test.objects.all()
|
||||||
|
|
||||||
status_filters = {
|
status_filters = {
|
||||||
'active' : Test.objects.filter(
|
'active' : Test.objects.filter(
|
||||||
@@ -77,7 +77,7 @@ class GetTests(generics.ListAPIView):
|
|||||||
testing__completion_date__lt=now
|
testing__completion_date__lt=now
|
||||||
).distinct()
|
).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):
|
def set_attemps_number(self, user, tests):
|
||||||
"""Updates the number of attempts remaining for each test for the user."""
|
"""Updates the number of attempts remaining for each test for the user."""
|
||||||
@@ -146,8 +146,6 @@ class TestCreate(APIView):
|
|||||||
file=test_image,
|
file=test_image,
|
||||||
name=request.data["name"],
|
name=request.data["name"],
|
||||||
description=request.data["description"],
|
description=request.data["description"],
|
||||||
datestart=request.data["datestart"],
|
|
||||||
dateend=request.data["dateend"],
|
|
||||||
author=user,
|
author=user,
|
||||||
pass_perc=request.data["pass_perc"],
|
pass_perc=request.data["pass_perc"],
|
||||||
time=request.data["time"],
|
time=request.data["time"],
|
||||||
|
|||||||
Reference in new issue
Block a user