Commit 8dfdb245 authored by Tim Honcoop's avatar Tim Honcoop
Browse files

Added the item id to the quiz


Added test cases
parent cefdbd9d
Pipeline #2144 passed with stage
in 3 minutes and 13 seconds
......@@ -37,12 +37,14 @@ class QuizSerializer(serializers.ModelSerializer):
"graded",
"lesson",
"lesson_name",
"item_id",
]
name = serializers.CharField()
graded = serializers.BooleanField()
lesson = serializers.SerializerMethodField()
lesson_name = serializers.SerializerMethodField()
item_id = serializers.SerializerMethodField()
def get_lesson(self, obj):
return obj.items.all()[0].lesson.lesson_id
......@@ -50,6 +52,9 @@ class QuizSerializer(serializers.ModelSerializer):
def get_lesson_name(self, obj):
return obj.items.all()[0].lesson.name
def get_item_id(self, obj):
return obj.items.all()[0].item_id
class QuizAnalyticsSerializer(QuizSerializer):
"""
Serialize a Quiz with its basic properties
......
......@@ -557,6 +557,7 @@ def test_quiz_analytics_view(
- graded
- lesson
- lesson_name
- item_id
- average_grade
- grade_distribution
- average_attempts
......@@ -591,6 +592,7 @@ def test_quiz_analytics_view(
"graded",
"lesson",
"lesson_name",
"item_id",
"average_grade",
"grade_distribution",
"average_attempts",
......@@ -733,6 +735,7 @@ def test_quiz_analytics_view_invalid_date_filter(
"graded",
"lesson",
"lesson_name",
"item_id",
"average_grade",
"grade_distribution",
"average_attempts",
......@@ -781,6 +784,7 @@ def test_quiz_analytics_next_quiz(
"graded",
"lesson",
"lesson_name",
"item_id",
"average_grade",
"grade_distribution",
"average_attempts",
......@@ -840,6 +844,7 @@ def test_quiz_version_list_view(
- graded
- lesson
- lesson_name
- item_id
"""
response = teacher_api_client.get(
reverse(
......@@ -861,6 +866,7 @@ def test_quiz_version_list_view(
"graded",
"lesson",
"lesson_name",
"item_id",
]
assert response.status_code == 200, str(response.content)
assert len(response.data) > 0, "no quizzes returned"
......@@ -886,6 +892,7 @@ def test_quiz_list_view(teacher_api_client, coursera_course_id):
- graded
- lesson
- lesson_name
- item_id
"""
response = teacher_api_client.get(
reverse("coursera-api:quiz-list", kwargs={"course_id": coursera_course_id})
......@@ -901,6 +908,7 @@ def test_quiz_list_view(teacher_api_client, coursera_course_id):
"graded",
"lesson",
"lesson_name",
"item_id",
]
assert response.status_code == 200, str(response.content)
assert len(response.data) > 0, "no quizzes returned"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment