Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.104.0 #2420

Merged
merged 6 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Release Notes
=============

Version 0.104.0
---------------

- Add required_prerequisites to program API (#2419)
- Update dependency django-cors-headers to v4 (#2372)
- Update dependency django-ipware to v7 (#2375)
- Update dependency django to v4.2.16 [SECURITY] (#2418)

Version 0.103.2 (Released October 17, 2024)
---------------

Expand Down
12 changes: 12 additions & 0 deletions courses/serializers/v2/programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ProgramSerializer(serializers.ModelSerializer):
departments = DepartmentSerializer(many=True, read_only=True)
topics = serializers.SerializerMethodField()
certificate_type = serializers.SerializerMethodField()
required_prerequisites = serializers.SerializerMethodField()

def get_courses(self, instance):
return [course[0].id for course in instance.courses if course[0].live]
Expand All @@ -34,6 +35,16 @@ def get_requirements(self, instance):
"electives": [course.id for course in instance.elective_courses],
}

def get_required_prerequisites(self, instance):
"""
Check if the prerequisites field is populated in the program page CMS.
"""
return bool(
hasattr(instance, "page")
and hasattr(instance.page, "prerequisites")
and instance.page.prerequisites != ""
)

def get_req_tree(self, instance):
req_root = instance.get_requirements_root()

Expand Down Expand Up @@ -83,6 +94,7 @@ class Meta:
"end_date",
"enrollment_start",
"enrollment_end",
"required_prerequisites",
]


Expand Down
10 changes: 10 additions & 0 deletions courses/serializers/v2/programs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,25 @@
@pytest.mark.parametrize(
"certificate_type", ["MicroMasters Credential", "Certificate of Completion"]
)
@pytest.mark.parametrize("prerequisites", ["program prerequisites", None, ""])
def test_serialize_program(
mock_context,
remove_tree,
certificate_type,
prerequisites,
program_with_empty_requirements, # noqa: F811
):
"""Test Program serialization"""
if certificate_type == "MicroMasters Credential":
program_with_empty_requirements.program_type = "MicroMasters®"
program_with_empty_requirements.save()

required_prerequisites = False
if prerequisites is not None:
program_with_empty_requirements.page.prerequisites = prerequisites
if prerequisites != "":
required_prerequisites = True

run1 = CourseRunFactory.create(
course__page=None,
start_date=now() + timedelta(hours=1),
Expand Down Expand Up @@ -95,5 +104,6 @@ def test_serialize_program(
"end_date": program_with_empty_requirements.end_date,
"enrollment_start": program_with_empty_requirements.enrollment_start,
"enrollment_end": program_with_empty_requirements.enrollment_end,
"required_prerequisites": required_prerequisites,
},
)
2 changes: 1 addition & 1 deletion main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from main.celery_utils import OffsettingSchedule
from main.sentry import init_sentry

VERSION = "0.103.2"
VERSION = "0.104.0"

log = logging.getLogger()

Expand Down
44 changes: 31 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ celery = "^5.2.2"
celery-redbeat = "^2.0.0"
deepdiff = "^6.6.1"
dj-database-url = "^0.5.0"
django = "4.2.15"
django = "4.2.16"
django-anymail = {extras = ["mailgun"], version = "^11.1"}
django-cors-headers = "^3.11.0"
django-cors-headers = "^4.0.0"
django-countries = "^7.2.1"
django-ipware = "^4.0.0"
django-ipware = "^7.0.0"
django-oauth-toolkit = "^1.7.0"
django-redis = "^5.0.0"
django-robots = "6.1"
Expand Down
Loading