Skip to content
Snippets Groups Projects
Unverified Commit f277841a authored by Carla Duarte's avatar Carla Duarte Committed by GitHub
Browse files

Merge pull request #28162 from edx/ciduarte/AA-875

feat: add problem scores to progress tab api (AA-875)
parents 423ac008 d754951c
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ class SubsectionScoresSerializer(serializers.Serializer):
num_points_earned = serializers.FloatField(source='graded_total.earned')
num_points_possible = serializers.FloatField(source='graded_total.possible')
percent_graded = serializers.FloatField()
problem_scores = serializers.SerializerMethodField()
show_correctness = serializers.CharField()
show_grades = serializers.SerializerMethodField()
url = serializers.SerializerMethodField()
......@@ -34,6 +35,16 @@ class SubsectionScoresSerializer(serializers.Serializer):
def get_block_key(self, subsection):
return str(subsection.location)
def get_problem_scores(self, subsection):
problem_scores = [
{
'earned': score.earned,
'possible': score.possible,
}
for score in subsection.problem_scores.values()
]
return problem_scores
def get_url(self, subsection):
relative_path = reverse('jump_to', args=[self.context['course_key'], subsection.location])
request = self.context['request']
......
......@@ -79,6 +79,9 @@ class ProgressTabView(RetrieveAPIView):
num_points_earned: (int) the amount of points the user has earned for the given subsection
num_points_possible: (int) the total amount of points possible for the given subsection
percent_graded: (float) the percentage of total points the user has received a grade for in a given subsection
problem_scores: List of objects that represent individual problem scores with the following fields:
earned: (float) number of earned points
possible: (float) number of possible points
show_correctness: (str) a str representing whether to show the problem/practice scores based on due date
('always', 'never', 'past_due', values defined in
common/lib/xmodule/xmodule/modulestore/inheritance.py)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment