From 8ff1b8555753d1cc8caa71f4bee9a823fcf9c1ff Mon Sep 17 00:00:00 2001 From: Rebecca David Date: Tue, 10 Dec 2024 13:37:49 -0500 Subject: [PATCH] fix: quality tests and migration errors --- cms/djangoapps/contentstore/views/course.py | 16 ++++++++++++---- .../migrations/0028_merge_20241210_1837.py | 14 ++++++++++++++ .../tests/test_course_overviews.py | 2 +- requirements/edx/base.txt | 2 +- requirements/edx/development.txt | 2 +- 5 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 openedx/core/djangoapps/content/course_overviews/migrations/0028_merge_20241210_1837.py diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 09ac62705ada..e3ac79832461 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -30,7 +30,12 @@ from opaque_keys import InvalidKeyError from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.locator import BlockUsageLocator -from organizations.api import add_organization_course, ensure_organization, get_course_organization, get_organization_institutions +from organizations.api import ( + add_organization_course, + ensure_organization, + get_course_organization, + get_organization_institutions +) from organizations.exceptions import InvalidOrganizationException from rest_framework.exceptions import ValidationError @@ -1184,10 +1189,13 @@ def settings_handler(request, course_key_string): # lint-amnesty, pylint: disab 'upgrade_deadline': upgrade_deadline, 'mfe_proctored_exam_settings_url': get_proctored_exam_settings_url(course_module.id), } - + course_org = get_course_organization(course_key) - institutions = get_organization_institutions(course_org) - settings_context.update({'possible_organization_institutions': list(institutions)}) + if (course_org): + institutions = get_organization_institutions(course_org) + settings_context.update({'possible_organization_institutions': list(institutions)}) + else: + settings_context.update({'possible_organization_institutions': []}) if is_prerequisite_courses_enabled(): courses, in_process_course_actions = get_courses_accessible_to_user(request) diff --git a/openedx/core/djangoapps/content/course_overviews/migrations/0028_merge_20241210_1837.py b/openedx/core/djangoapps/content/course_overviews/migrations/0028_merge_20241210_1837.py new file mode 100644 index 000000000000..ef6e63016cc5 --- /dev/null +++ b/openedx/core/djangoapps/content/course_overviews/migrations/0028_merge_20241210_1837.py @@ -0,0 +1,14 @@ +# Generated by Django 3.2.16 on 2024-12-10 18:37 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('course_overviews', '0027_auto_20240909_1523'), + ('course_overviews', '0027_merge_20240123_1603'), + ] + + operations = [ + ] diff --git a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py index e06064f8f142..5e2a7442c2ab 100644 --- a/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py +++ b/openedx/core/djangoapps/content/course_overviews/tests/test_course_overviews.py @@ -380,7 +380,7 @@ def test_malformed_grading_policy(self): course_overview = CourseOverview._create_or_update(course) # pylint: disable=protected-access assert course_overview.lowest_passing_grade is None - @ddt.data((ModuleStoreEnum.Type.mongo, 5, 5), (ModuleStoreEnum.Type.split, 2, 2)) + @ddt.data((ModuleStoreEnum.Type.mongo, 6, 6), (ModuleStoreEnum.Type.split, 2, 2)) @ddt.unpack def test_versioning(self, modulestore_type, min_mongo_calls, max_mongo_calls): """ diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index c8c362831128..1340882baa2e 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -1149,7 +1149,7 @@ zipp==3.8.0 # via -r ./requirements/edx/private.txt -e git+https://github.com/CUCWD/edx-organizations.git@6.11.1.2-cucwd-nutmeg#egg=edx-organizations==6.11.1 # via -r ./requirements/edx/private.txt --e git+https://github.com/CUCWD/social-auth-backend-bigcommerce.git@0.1.0-maple.1#egg=social-auth-backend-bigcommerce==0.1.0-maple.1 +-e git+https://github.com/CUCWD/social-auth-backend-bigcommerce.git@0.1.0-maple.1#egg=social-auth-backend-bigcommerce==0.1.0 # via -r ./requirements/edx/private.txt # -e git+https://github.com/CUCWD/edx-ora2.git@4.1.2-nutmeg-cucwd#egg=ora2==4.1.2 -e git+https://github.com/CUCWD/custom-form-app.git@0.1-maple.3-cucwd#egg=custom-form-app==0.1 diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index df119bc4eb97..effede1f42bb 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -1654,7 +1654,7 @@ zipp==3.8.0 # via -r ./requirements/edx/private.txt -e git+https://github.com/CUCWD/edx-organizations.git@6.11.1.2-cucwd-nutmeg#egg=edx-organizations==6.11.1 # via -r ./requirements/edx/private.txt - -e git+https://github.com/CUCWD/social-auth-backend-bigcommerce.git@0.1.0-maple.1#egg=social-auth-backend-bigcommerce==0.1.0-maple.1 + -e git+https://github.com/CUCWD/social-auth-backend-bigcommerce.git@0.1.0-maple.1#egg=social-auth-backend-bigcommerce==0.1.0 # via -r ./requirements/edx/private.txt -e git+https://github.com/CUCWD/edx-ora2.git@4.1.2-nutmeg-cucwd#egg=ora2==4.1.2 # via -r ./requirements/edx/private.txt