Skip to content

Commit

Permalink
Update student dashboards to only pull data from Blockly levels
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Aug 23, 2024
1 parent 996b4ac commit 8014ad3
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
48 changes: 48 additions & 0 deletions portal/tests/snapshots/snap_test_partials.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,51 @@
</div>
</div>
'''

snapshots['test_benefits 1'] = '''
<div class="grid-benefits col-sm-8 col-center">
<h5 class="grid-benefits__title grid-benefits__title1">Test title</h5>
<h5 class="grid-benefits__title grid-benefits__title2">Test title</h5>
<h5 class="grid-benefits__title grid-benefits__title3">Test title</h5>
<p class="grid-benefits__text1">Test text</p>
<p class="grid-benefits__text2">Test text</p>
<p class="grid-benefits__text3">Test text</p>
<div class="grid-benefits__button grid-benefits__button1">
<a href="/" class="button button--secondary button--secondary--dark">Test button</a>
</div>
<div class="grid-benefits__button grid-benefits__button2">
<a href="/" class="button button--secondary button--secondary--dark">Test button</a>
</div>
<div class="grid-benefits__button grid-benefits__button3">
<a href="/" class="button button--secondary button--secondary--dark">Test button</a>
</div>
</div>
'''

snapshots['test_headline 1'] = '''<section>
<h4>Test title</h4>
</section>
<p class="container">Test description</p>
'''
6 changes: 3 additions & 3 deletions portal/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,15 +563,15 @@ def test_student_dashboard_view(self):
"num_completed": 0,
"num_top_scores": 0,
"total_score": 0,
"total_available_score": 2040,
"total_available_score": 1450,
}

# Expected context data when a student has attempted some RR levels
EXPECTED_DATA_WITH_ATTEMPTS = {
"num_completed": 2,
"num_top_scores": 1,
"total_score": 39,
"total_available_score": 2040,
"total_available_score": 1450,
}

# Expected context data when a student has also attempted some custom RR
Expand All @@ -580,7 +580,7 @@ def test_student_dashboard_view(self):
"num_completed": 2,
"num_top_scores": 1,
"total_score": 39,
"total_available_score": 2040,
"total_available_score": 1450,
"total_custom_score": 10,
"total_custom_available_score": 20,
}
Expand Down
4 changes: 2 additions & 2 deletions portal/views/student/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
the student's scores for any levels shared with them by their teacher.
"""
# Get score data for all original levels
levels = Level.objects.sorted_levels()
levels = Level.objects.filter(episode__pk__in=range(1, 10))
student = self.request.user.new_student

context_data = _compute_rapid_router_scores(student, levels)
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_func(self) -> Optional[bool]:
return logged_in_as_independent_student(self.request.user)

def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
levels = Level.objects.sorted_levels()
levels = Level.objects.filter(episode__pk__in=range(1, 10))
student = self.request.user.new_student

return _compute_rapid_router_scores(
Expand Down

0 comments on commit 8014ad3

Please sign in to comment.