Skip to content

Commit 8d0b1df

Browse files
committed
Update the HYL fields to compress them down into a single field
1 parent 58e9dfb commit 8d0b1df

6 files changed

Lines changed: 146 additions & 234 deletions

File tree

cms/constants.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,43 @@
1212
ONE_MINUTE = 60
1313

1414
FEATURED_ITEMS_CACHE_KEY = "CMS_homepage_featured_courses"
15+
16+
HYL_CHOICE_REALWORLD_LEARNING = {
17+
"icon": "IconConnectedPeople",
18+
"title": "Real-World Learning",
19+
"text": "Learn from MIT faculty and experts who ground their teaching in real-world cases rather than mathematical models, making the material approachable for all.",
20+
}
21+
HYL_CHOICE_LEARN_BY_DOING = {
22+
"icon": "IconBrains",
23+
"title": "Practical Application",
24+
"text": "Apply your new knowledge with hands-on, practical exercises drawn from healthcare, sports, finance, sustainability, and more.",
25+
}
26+
HYL_CHOICE_LEARN_FROM_OTHERS = {
27+
"icon": "IconBrains",
28+
"title": "Learn From Others",
29+
"text": "Connect with an international community of professionals working on real-world projects.",
30+
}
31+
HYL_CHOICE_LEARN_ON_DEMAND = {
32+
"icon": "IconBrains",
33+
"title": "Learn On Demand",
34+
"text": "Access all course content online with complete flexibility to study at your own pace.",
35+
}
36+
HYL_CHOICE_AI_ENABLED_SUPPORT = {
37+
"icon": "IconComputerBulb",
38+
"title": "AI-Enabled Support",
39+
"text": "Deepen your understanding of the course material and get help on assignments from AskTIM, the AI assistant built by MIT researchers.",
40+
}
41+
HYL_CHOICE_STACKABLE_CREDENTIALS = {
42+
"icon": "IconCertificate",
43+
"title": "Stackable Credentials",
44+
"text": "Earn an MIT Open Learning certificate at each milestone—module, course, and program—demonstrating your AI expertise. Available in paid courses only.",
45+
}
46+
47+
HYL_CHOICES = {
48+
"realworld_learning": HYL_CHOICE_REALWORLD_LEARNING,
49+
"learn_by_doing": HYL_CHOICE_LEARN_BY_DOING,
50+
"learn_from_others": HYL_CHOICE_LEARN_FROM_OTHERS,
51+
"learn_on_demand": HYL_CHOICE_LEARN_ON_DEMAND,
52+
"ai_enabled_support": HYL_CHOICE_AI_ENABLED_SUPPORT,
53+
"stackable_credentials": HYL_CHOICE_STACKABLE_CREDENTIALS,
54+
}

cms/models.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
from cms.constants import (
5959
CERTIFICATE_INDEX_SLUG,
6060
COURSE_INDEX_SLUG,
61+
HYL_CHOICES,
6162
INSTRUCTOR_INDEX_SLUG,
6263
PROGRAM_COLLECTION_INDEX_SLUG,
6364
PROGRAM_INDEX_SLUG,
@@ -1295,12 +1296,7 @@ class Meta:
12951296
APIField("faculty_section_title"),
12961297
APIField("faculty"),
12971298
APIField("certificate_page", serializer=ProductChildPageSerializer()),
1298-
APIField("hyl_choice_realworld_learning"),
1299-
APIField("hyl_choice_learn_by_doing"),
1300-
APIField("hyl_choice_learn_from_others"),
1301-
APIField("hyl_choice_learn_on_demand"),
1302-
APIField("hyl_choice_ai_enabled_support"),
1303-
APIField("hyl_choice_stackable_credentials"),
1299+
APIField("how_youll_learn"),
13041300
]
13051301

13061302
subpage_types = ["FlexiblePricingRequestForm", "CertificatePage"]
@@ -1361,6 +1357,16 @@ def product(self):
13611357
"""Returns the courseware object (Course, Program) associated with this page"""
13621358
raise NotImplementedError
13631359

1360+
@property
1361+
def how_youll_learn(self):
1362+
"""Returns the selected choices for the How You'll Learn section."""
1363+
1364+
return [
1365+
{"key": key, **HYL_CHOICES[key]}
1366+
for key in HYL_CHOICES
1367+
if getattr(self, f"hyl_choice_{key}", False)
1368+
]
1369+
13641370
def get_url_parts(self, request=None):
13651371
"""
13661372
Overrides base method for returning the parts of the URL for pages of this class

cms/wagtail_api/schema/serializers.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ class OverrideSerializer(serializers.Serializer):
8686
id = serializers.CharField()
8787

8888

89+
class HowYoullLearnSerializer(serializers.Serializer):
90+
"""Serializer for the How You'll Learn generated property"""
91+
92+
key = serializers.CharField()
93+
icon = serializers.CharField()
94+
title = serializers.CharField()
95+
text = serializers.CharField()
96+
97+
8998
class PageMetaSerializer(serializers.Serializer):
9099
"""
91100
Serializer for page metadata used in various Wagtail pages.
@@ -189,12 +198,7 @@ class Meta:
189198
"topic_list",
190199
"include_in_learn_catalog",
191200
"ingest_content_files_for_ai",
192-
"hyl_choice_realworld_learning",
193-
"hyl_choice_learn_by_doing",
194-
"hyl_choice_learn_from_others",
195-
"hyl_choice_learn_on_demand",
196-
"hyl_choice_ai_enabled_support",
197-
"hyl_choice_stackable_credentials",
201+
"how_youll_learn",
198202
]
199203

200204
# NOTE: We use this serializer for schema generation only,
@@ -208,6 +212,7 @@ class Meta:
208212
certificate_page = CertificatePageSerializer(allow_null=True)
209213
course_details = CourseSerializer()
210214
topic_list = TopicSerializer(many=True)
215+
how_youll_learn = HowYoullLearnSerializer(many=True)
211216

212217

213218
class CoursePageListSerializer(serializers.Serializer):
@@ -252,12 +257,7 @@ class Meta:
252257
"faculty",
253258
"certificate_page",
254259
"program_details",
255-
"hyl_choice_realworld_learning",
256-
"hyl_choice_learn_by_doing",
257-
"hyl_choice_learn_from_others",
258-
"hyl_choice_learn_on_demand",
259-
"hyl_choice_ai_enabled_support",
260-
"hyl_choice_stackable_credentials",
260+
"how_youll_learn",
261261
]
262262

263263
# NOTE: We use this serializer for schema generation only,
@@ -277,6 +277,7 @@ def get_description(self, instance):
277277
faculty = FacultySerializer(many=True)
278278
certificate_page = CertificatePageSerializer()
279279
program_details = ProgramSerializer()
280+
how_youll_learn = HowYoullLearnSerializer(many=True)
280281

281282

282283
class ProgramPageListSerializer(serializers.Serializer):

openapi/specs/v0.yaml

Lines changed: 27 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4192,36 +4192,10 @@ components:
41924192
nullable: true
41934193
description: If true, allow the AI chatbots to ingest the course's content
41944194
files.
4195-
hyl_choice_realworld_learning:
4196-
type: boolean
4197-
nullable: true
4198-
description: Learn from faculty experts who emphasize practical application
4199-
over theory.
4200-
hyl_choice_learn_by_doing:
4201-
type: boolean
4202-
nullable: true
4203-
description: Practice core competencies through case studies, simulations,
4204-
and hands-on tools.
4205-
hyl_choice_learn_from_others:
4206-
type: boolean
4207-
nullable: true
4208-
description: Connect with an international community of professionals working
4209-
on real-world projects.
4210-
hyl_choice_learn_on_demand:
4211-
type: boolean
4212-
nullable: true
4213-
description: Access all course content online with complete flexibility
4214-
to study at your own pace.
4215-
hyl_choice_ai_enabled_support:
4216-
type: boolean
4217-
nullable: true
4218-
description: Get personalized help on assignments from AskTIM, powered by
4219-
advanced AI.
4220-
hyl_choice_stackable_credentials:
4221-
type: boolean
4222-
nullable: true
4223-
description: Earn certificates at key milestones—module, course, and program—building
4224-
a portfolio of expertise.
4195+
how_youll_learn:
4196+
type: array
4197+
items:
4198+
$ref: '#/components/schemas/HowYoullLearn'
42254199
required:
42264200
- about
42274201
- certificate_page
@@ -4232,12 +4206,7 @@ components:
42324206
- faculty_section_title
42334207
- faq_url
42344208
- feature_image
4235-
- hyl_choice_ai_enabled_support
4236-
- hyl_choice_learn_by_doing
4237-
- hyl_choice_learn_from_others
4238-
- hyl_choice_learn_on_demand
4239-
- hyl_choice_realworld_learning
4240-
- hyl_choice_stackable_credentials
4209+
- how_youll_learn
42414210
- id
42424211
- include_in_learn_catalog
42434212
- ingest_content_files_for_ai
@@ -5477,6 +5446,23 @@ components:
54775446
- Elementary/primary school
54785447
- No formal education
54795448
- Other education
5449+
HowYoullLearn:
5450+
type: object
5451+
description: Serializer for the How You'll Learn generated property
5452+
properties:
5453+
key:
5454+
type: string
5455+
icon:
5456+
type: string
5457+
title:
5458+
type: string
5459+
text:
5460+
type: string
5461+
required:
5462+
- icon
5463+
- key
5464+
- text
5465+
- title
54805466
IntegrationTypeEnum:
54815467
enum:
54825468
- sso
@@ -7025,36 +7011,10 @@ components:
70257011
$ref: '#/components/schemas/CertificatePage'
70267012
program_details:
70277013
$ref: '#/components/schemas/V2Program'
7028-
hyl_choice_realworld_learning:
7029-
type: boolean
7030-
nullable: true
7031-
description: Learn from faculty experts who emphasize practical application
7032-
over theory.
7033-
hyl_choice_learn_by_doing:
7034-
type: boolean
7035-
nullable: true
7036-
description: Practice core competencies through case studies, simulations,
7037-
and hands-on tools.
7038-
hyl_choice_learn_from_others:
7039-
type: boolean
7040-
nullable: true
7041-
description: Connect with an international community of professionals working
7042-
on real-world projects.
7043-
hyl_choice_learn_on_demand:
7044-
type: boolean
7045-
nullable: true
7046-
description: Access all course content online with complete flexibility
7047-
to study at your own pace.
7048-
hyl_choice_ai_enabled_support:
7049-
type: boolean
7050-
nullable: true
7051-
description: Get personalized help on assignments from AskTIM, powered by
7052-
advanced AI.
7053-
hyl_choice_stackable_credentials:
7054-
type: boolean
7055-
nullable: true
7056-
description: Earn certificates at key milestones—module, course, and program—building
7057-
a portfolio of expertise.
7014+
how_youll_learn:
7015+
type: array
7016+
items:
7017+
$ref: '#/components/schemas/HowYoullLearn'
70587018
required:
70597019
- about
70607020
- certificate_page
@@ -7064,12 +7024,7 @@ components:
70647024
- faculty_section_title
70657025
- faq_url
70667026
- feature_image
7067-
- hyl_choice_ai_enabled_support
7068-
- hyl_choice_learn_by_doing
7069-
- hyl_choice_learn_from_others
7070-
- hyl_choice_learn_on_demand
7071-
- hyl_choice_realworld_learning
7072-
- hyl_choice_stackable_credentials
7027+
- how_youll_learn
70737028
- id
70747029
- length
70757030
- max_price

0 commit comments

Comments
 (0)