serializers
This commit is contained in:
1 parent
b763c0e894
commit
f3894c9ce2
1 file changed
+4
-3
@@ -115,7 +115,8 @@ class TestsSerializer(serializers.ModelSerializer):
|
||||
if not user.is_authenticated:
|
||||
return None
|
||||
|
||||
testing = Testing.objects.filter(test=obj, user=user).order_by('-completion_date').first()
|
||||
# testing = Testing.objects.filter(test=obj, user=user, is_active=True).order_by('-completion_date').first()
|
||||
testing = Testing.objects.filter(test=obj, user=user, is_active=True).first()
|
||||
if testing and testing.completion_date:
|
||||
return testing.completion_date
|
||||
return None
|
||||
@@ -125,7 +126,7 @@ class TestsSerializer(serializers.ModelSerializer):
|
||||
if not user.is_authenticated:
|
||||
return None
|
||||
|
||||
testing = Testing.objects.filter(test=obj, user=user, is_active=True).order_by('-completion_date').first()
|
||||
testing = Testing.objects.filter(test=obj, user=user, is_active=True).first()
|
||||
if testing and testing.test_passed:
|
||||
return testing.test_passed
|
||||
return None
|
||||
@@ -135,7 +136,7 @@ class TestsSerializer(serializers.ModelSerializer):
|
||||
if not user.is_authenticated:
|
||||
return None
|
||||
|
||||
testing = Testing.objects.filter(test=obj, user=user, is_active=True)
|
||||
testing = Testing.objects.filter(test=obj, user=user, is_active=True).first()
|
||||
if testing and testing.is_active:
|
||||
return testing.is_active
|
||||
return False
|
||||
|
||||
Reference in new issue
Block a user