From 8014ad30fcbc5fc9bc97df9a74ce28bb15e6781a Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Fri, 23 Aug 2024 23:47:25 +0100 Subject: [PATCH] Update student dashboards to only pull data from Blockly levels --- portal/tests/snapshots/snap_test_partials.py | 48 ++++++++++++++++++++ portal/tests/test_views.py | 6 +-- portal/views/student/play.py | 4 +- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/portal/tests/snapshots/snap_test_partials.py b/portal/tests/snapshots/snap_test_partials.py index 082ccb666..fc7dfeeec 100644 --- a/portal/tests/snapshots/snap_test_partials.py +++ b/portal/tests/snapshots/snap_test_partials.py @@ -36,3 +36,51 @@ ''' + +snapshots['test_benefits 1'] = ''' + +
+ + + + +
Test title
+ + +
Test title
+ + +
Test title
+ +

Test text

+

Test text

+

Test text

+ +
+ + Test button + +
+ + +
+ + Test button + +
+ + +
+ + Test button + +
+ +
+''' + +snapshots['test_headline 1'] = '''
+

Test title

+
+

Test description

+''' diff --git a/portal/tests/test_views.py b/portal/tests/test_views.py index 3837eab8d..772f310b6 100644 --- a/portal/tests/test_views.py +++ b/portal/tests/test_views.py @@ -563,7 +563,7 @@ 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 @@ -571,7 +571,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, } # Expected context data when a student has also attempted some custom RR @@ -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, } diff --git a/portal/views/student/play.py b/portal/views/student/play.py index d82d07135..4d4684b60 100644 --- a/portal/views/student/play.py +++ b/portal/views/student/play.py @@ -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) @@ -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(