feat: surface subsection block keys in progress api

This commit is contained in:
Carla Duarte
2021-05-28 16:16:14 -04:00
parent 3027cab454
commit cecd37c45b
3 changed files with 6 additions and 1 deletions

View File

@@ -83,7 +83,7 @@ class OutlineTabView(RetrieveAPIView):
expiration_date: (str) When the access expires, in ISO 8601 notation
masquerading_expired_course: (bool) Whether this course is expired for the masqueraded user
upgrade_deadline: (str) Last chance to upgrade, in ISO 8601 notation (or None if can't upgrade anymore)
upgrade_url: (str) Upgrade linke (or None if can't upgrade anymore)
upgrade_url: (str) Upgrade link (or None if can't upgrade anymore)
course_blocks:
blocks: List of serialized Course Block objects. Each serialization has the following fields:
id: (str) The usage ID of the block.

View File

@@ -21,6 +21,7 @@ class SubsectionScoresSerializer(serializers.Serializer):
"""
assignment_type = serializers.CharField(source='format')
display_name = serializers.CharField()
block_key = serializers.SerializerMethodField()
has_graded_assignment = serializers.BooleanField(source='graded')
num_points_earned = serializers.IntegerField(source='graded_total.earned')
num_points_possible = serializers.IntegerField(source='graded_total.possible')
@@ -29,6 +30,9 @@ class SubsectionScoresSerializer(serializers.Serializer):
show_grades = serializers.SerializerMethodField()
url = serializers.SerializerMethodField()
def get_block_key(self, subsection):
return str(subsection.location)
def get_url(self, subsection):
relative_path = reverse('jump_to', args=[self.context['course_key'], subsection.location])
request = self.context['request']

View File

@@ -66,6 +66,7 @@ class ProgressTabView(RetrieveAPIView):
display_name: (str) a str of what the name of the Chapter is for displaying on the site
subsections: List of serialized Subsections, each has the following fields:
assignment_type: (str) the format, if any, of the Subsection (Homework, Exam, etc)
block_key: (str) the key of the given subsection block
display_name: (str) a str of what the name of the Subsection is for displaying on the site
has_graded_assignment: (bool) whether or not the Subsection is a graded assignment
num_points_earned: (int) the amount of points the user has earned for the given subsection