feature/prepare-example-tests #19

Merged
s470631 merged 2 commits from feature/prepare-example-tests into master 2021-12-14 00:20:07 +01:00
4 changed files with 100 additions and 47 deletions
Showing only changes of commit a5b3079acc - Show all commits

51
example_ans.json Normal file
View File

@ -0,0 +1,51 @@
16
{
"answers": [
{
"question": 23,
"answer": 67
},
{
"question": 24,
"answer": 70
},
{
"question": 25,
"answer": 74
},
{
"question": 26,
"answer": 81
},
{
"question": 27,
"answer": 85
}
]
}
{
"answers": [
{
"question": 23,
"answer": 67
},
{
"question": 24,
"answer": 70
},
{
"question": 25,
"answer": 74
},
{
"question": 26,
"answer": 81
},
{
"question": 27,
"answer": 84
}
]
}

View File

@ -1,124 +1,124 @@
{
"name": "fiz1",
"name": "Matematyka 1",
"passing_score": 3,
"questions": [
{
"name": "Jaki jest najwyższy szczyt w Polsce ? ",
"name": "jaki jest wzór na pole powierzchni prostopadłościanu?",
"description": "ramię głowicy",
"answers": [
{
"description": "Rysy",
"description": "P = a*b*c",
"is_correct": false
},
{
"description": "P = 2(a*b+b*c+a*c)",
"is_correct": true
},
{
"description": "Śnieżka",
"description": "P = a*b + b*c + a*c",
"is_correct": false
},
{
"description": "Babia góra",
"is_correct": false
},
{
"description": "Tarnica",
"description": "P = 2*a*b*c",
"is_correct": false
}
]
},
{
"name": "Jaką długość ma Odra na terenie Polski ?",
"name": "ile wynosi pole kwadratu o boku długości 4cm",
"description": "złącze.",
"answers": [
{
"description": "854",
"description": "12",
"is_correct": false
},
{
"description": "742",
"is_correct": true
},
{
"description": "772",
"description": "8",
"is_correct": false
},
{
"description": "808",
"description": "16",
"is_correct": false
},
{
"description": "20",
"is_correct": false
}
]
},
{
"name": "Jaką wysokość ma śnieżka?",
"name": "ile wynosi objętość prostopadłościanu o wymiarach a=4, b=3,c=8",
"description": "kieszeń napędu",
"answers": [
{
"description": "1346",
"description": "56",
"is_correct": false
},
{
"description": "1603",
"description": "96",
"is_correct": true
},
{
"description": "2000",
"description": "82",
"is_correct": false
},
{
"description": "1863",
"description": "106",
"is_correct": false
}
]
},
{
"name": "która rzeka jest najdłuższa",
"name": "Jaką miarę na kąt którego cosinus wynosi 1?",
"description": "płytka drukowana .",
"answers": [
{
"description": "Warta",
"is_correct": false
},
{
"description": "Narew",
"is_correct": false
},
{
"description": "Wisła",
"description": "0",
"is_correct": true
},
{
"description": "Bug",
"description": "45",
"is_correct": false
},
{
"description": "90",
"is_correct": false
},
{
"description": "30",
"is_correct": false
}
]
},
{
"name": "Która rzeka nie przebiega przez Poznań?",
"name": "Jaka jest pochodna funkcji f(x) = 3x+1?",
"description": "karta dźwiękowa.",
"answers": [
{
"description": "Warta",
"description": "4",
"is_correct": false
},
{
"description": "Głuszynka",
"is_correct": false
},
{
"description": "Wierzbak",
"is_correct": false
},
{
"description": "Noteć",
"description": "3",
"is_correct": true
},
{
"description": "0",
"is_correct": false
},
{
"description": "1",
"is_correct": false
}
]
}
],
"category": {
"name": "Geografia"
"name": "Matematyka"
}
}

View File

@ -42,7 +42,9 @@ class TestValidateAPIView(views.APIView):
def post(self, request, test_id, **kwargs):
test = Test.objects.get(id=test_id)
import pdb;pdb.set_trace()
score = self.get_score(test, request.data["answers"])
import pdb;pdb.set_trace()
status = score >= test.passing_score
return Response({
"status": self.PASSED.get(status, self.UNKNOWN),

View File

@ -28,7 +28,7 @@ class RegisterViewSet(generics.GenericAPIView):
last_name=data["last_name"],
password=data["password"]
)
return Response({"detail": "Done"}, status=status.HTTP_200_OK)
return Response({"detail": "Konto zostało pomyślnie założone. Możesz się zalogować!"}, status=status.HTTP_200_OK)
else:
return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)