From 9e8bbb3f69a95f9dc1cac01cfd087d0386998f84 Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Mon, 29 Jan 2024 16:37:39 -0500 Subject: [PATCH 1/4] fix: test only accepts int values in priority This test https://github.com/openedx/edx-platform/blob/open-release/palm.master/cms/djangoapps/contentstore/rest_api/v0/tests/test_tabs.py#L108 dont accept None value in a list sort function. So as this is order ascending, a big value gives the same beahviour Also progress would be first than dates. --- lms/djangoapps/courseware/tabs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index 94caf0a4fb94..1949cd268864 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -61,6 +61,7 @@ class SyllabusTab(EnrolledTab): """ type = 'syllabus' title = gettext_noop('Syllabus') + priority = 980 view_name = 'syllabus' allow_multiple = True is_default = False @@ -78,6 +79,7 @@ class ProgressTab(EnrolledTab): """ type = 'progress' title = gettext_noop('Progress') + priority = 990 view_name = 'progress' is_hideable = True is_default = False @@ -303,6 +305,7 @@ class DatesTab(EnrolledTab): type = "dates" # We don't have the user in this context, so we don't want to translate it at this level. title = gettext_noop("Dates") + priority = 1000 view_name = "dates" def __init__(self, tab_dict): From 61816d5e815837b2cc7909186549c0c653bd51a3 Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Mon, 29 Jan 2024 18:25:18 -0500 Subject: [PATCH 2/4] fix: primitive delete in tabs test now dates is the last element of ithe list and progress is always before dates.(penultimate) --- cms/djangoapps/contentstore/views/tests/test_tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py index 5966895d2f49..d2266933982f 100644 --- a/cms/djangoapps/contentstore/views/tests/test_tabs.py +++ b/cms/djangoapps/contentstore/views/tests/test_tabs.py @@ -191,7 +191,7 @@ def test_delete(self): tabs.primitive_delete(course, 6) assert course.tabs[1] != {'type': 'dates', 'name': 'Dates'} - tabs.primitive_delete(course, 1) + tabs.primitive_delete(course, -2) assert {'type': 'progress'} not in course.tabs # Check that dates has shifted up assert course.tabs[1] == {'type': 'dates', 'name': 'Dates'} From 6109a1cb8015e2b0003c1741762b75e3d31200fc Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Mon, 29 Jan 2024 19:38:59 -0500 Subject: [PATCH 3/4] fix: add allowd index for delete progress The function validate_args https://github.com/openedx/edx-platform/blob/open-release/palm.master/cms/djangoapps/contentstore/views/tabs.py#L233 only allow num >=1 --- cms/djangoapps/contentstore/views/tests/test_tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py index d2266933982f..4e219720fac0 100644 --- a/cms/djangoapps/contentstore/views/tests/test_tabs.py +++ b/cms/djangoapps/contentstore/views/tests/test_tabs.py @@ -191,7 +191,7 @@ def test_delete(self): tabs.primitive_delete(course, 6) assert course.tabs[1] != {'type': 'dates', 'name': 'Dates'} - tabs.primitive_delete(course, -2) + tabs.primitive_delete(course, len(course.tabs) - 2) assert {'type': 'progress'} not in course.tabs # Check that dates has shifted up assert course.tabs[1] == {'type': 'dates', 'name': 'Dates'} From 1a3d0dfd7b2ff7896fb8c48eb140cb946bd6466d Mon Sep 17 00:00:00 2001 From: Johan Castiblanco Date: Mon, 29 Jan 2024 20:55:14 -0500 Subject: [PATCH 4/4] fix: ensure dates is the last element --- cms/djangoapps/contentstore/views/tests/test_tabs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py index 4e219720fac0..3f0a6f02f1b4 100644 --- a/cms/djangoapps/contentstore/views/tests/test_tabs.py +++ b/cms/djangoapps/contentstore/views/tests/test_tabs.py @@ -194,7 +194,7 @@ def test_delete(self): tabs.primitive_delete(course, len(course.tabs) - 2) assert {'type': 'progress'} not in course.tabs # Check that dates has shifted up - assert course.tabs[1] == {'type': 'dates', 'name': 'Dates'} + assert course.tabs[-1] == {'type': 'dates', 'name': 'Dates'} def test_insert(self): """Test primitive tab insertion."""