chore [P-01]: подтянул бэк
This commit is contained in:
commit
d5d15bb26f
1 file changed
+7
-3
@@ -227,13 +227,17 @@ class TestingView(generics.ListCreateAPIView):
|
||||
)
|
||||
def get(self, request):
|
||||
"""Get all testing records for a test"""
|
||||
user = request.user
|
||||
test_id = request.query_params.get('test_id')
|
||||
try:
|
||||
if test_id:
|
||||
testings = Testing.objects.filter(test_id=test_id).select_related('user__user')
|
||||
testings = Testing.objects.filter(test_id=test_id,
|
||||
is_active=True,
|
||||
user=user).select_related('user__user')
|
||||
else:
|
||||
testings = Testing.objects.all().select_related('user__user')
|
||||
|
||||
testings = Testing.objects.filter(is_active=True,
|
||||
user=user).select_related('user__user')
|
||||
|
||||
serializer = self.get_serializer(testings, many=True)
|
||||
return Response(serializer.data)
|
||||
except DatabaseError as e:
|
||||
|
||||
Reference in new issue
Block a user