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

Fix part of #5344: Update models to support classrooms #5418

Merged
merged 40 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f6b1f60
Add ClassroomIdList & ClassroomSummary protos
theMr17 May 30, 2024
fdcf183
Add classroom_id & classroom_title fields
theMr17 May 30, 2024
a66a5ac
Add json & textproto test data
theMr17 May 30, 2024
b292594
Update controllers to add classroom references in topics and stories
theMr17 May 30, 2024
d68d1b5
Add and update tests for controller changes
theMr17 May 30, 2024
69352df
Remove ClassroomList model
theMr17 May 30, 2024
700a001
Fix ktlint issues
theMr17 May 30, 2024
9063bcd
Fix textproto syntax issue
theMr17 May 30, 2024
8ce636d
Fix textproto syntax issue
theMr17 May 30, 2024
dbe9842
TopicListController is updated to load all topics irrespective of the…
theMr17 May 31, 2024
238d96c
Fix failing tests of TopicControllerTest
theMr17 May 31, 2024
d5a8bc8
Update test_classroom_id_0.textproto
theMr17 May 31, 2024
db67666
Update test_classroom_id_1.textproto
theMr17 May 31, 2024
405f160
Update test_classroom_id_2.textproto
theMr17 May 31, 2024
ff3444f
Add classroom file names in domain assets list
theMr17 May 31, 2024
4c5f322
Update domain_assets.bzl
theMr17 May 31, 2024
2a26a2b
Remove classroom thumbnail data from test_classroom_id_0
theMr17 May 31, 2024
c22fead
Remove classroom thumbnail data from test_classroom_id_1
theMr17 May 31, 2024
6cb9146
Remove classroom thumbnail data from test_classroom_id_2
theMr17 May 31, 2024
b214206
Fix bazel lint issue
theMr17 May 31, 2024
884a675
Introduce topic_ids field for classrooms
theMr17 May 31, 2024
9fbfda3
Fix textproto formatting issue
theMr17 May 31, 2024
e1c9254
Add EphemeralClassroomSummary & ClassroomList objects
theMr17 Jun 5, 2024
c82994e
Remove classroom info from CompletedStory
theMr17 Jun 6, 2024
2649461
Fix error message
theMr17 Jun 6, 2024
857d296
Update comments
theMr17 Jun 6, 2024
693bfe8
Revert "Introduce topic_ids field for classrooms"
theMr17 Jun 6, 2024
4b3d596
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 12, 2024
73fb79e
Remove extra new line
theMr17 Jun 13, 2024
2432150
Move classroom titles to ephemeral objects and pass the class written…
theMr17 Jun 14, 2024
d2a454d
Remove classroom title from topic data files
theMr17 Jun 14, 2024
ac24de1
Fix regex validation checks
theMr17 Jun 14, 2024
6cf8ae4
Handle empty classroom id when the proto asset is overridden for tests
theMr17 Jun 15, 2024
3d91ac2
Remove classroom ID from topic data files
theMr17 Jun 20, 2024
8296e2e
Remove unused import & variable
theMr17 Jun 20, 2024
8c5a77b
Fetch classroom ID from topic ID
theMr17 Jun 20, 2024
37dc6a3
Update left out classroom ID fetching
theMr17 Jun 20, 2024
9a328e5
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 20, 2024
74c29af
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 23, 2024
8f73b16
Merge branch 'develop' into multiple-classrooms-model-support
theMr17 Jun 24, 2024
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
5 changes: 5 additions & 0 deletions domain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ MIGRATED_PROD_FILES = glob([

DOMAIN_ASSETS = generate_assets_list_from_text_protos(
name = "domain_assets",
classroom_file_names = [
"test_classroom_id_0",
"test_classroom_id_1",
"test_classroom_id_2",
],
classroom_list_file_names = [
"classrooms",
],
Expand Down
15 changes: 13 additions & 2 deletions domain/domain_assets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("//model:text_proto_assets.bzl", "generate_proto_binary_assets")

def generate_assets_list_from_text_protos(
name,
classroom_file_names,
classroom_list_file_names,
topic_file_names,
subtopic_file_names,
Expand All @@ -17,6 +18,7 @@ def generate_assets_list_from_text_protos(

Args:
name: str. The name of this generation instance. This will be a prefix for derived targets.
classroom_file_names: list of str. The list of classroom file names.
classroom_list_file_names: list of str. The classroom list file names.
topic_file_names: list of str. The list of topic file names.
subtopic_file_names: list of str. The list of subtopic file names.
Expand All @@ -31,8 +33,17 @@ def generate_assets_list_from_text_protos(
name = name,
names = classroom_list_file_names,
proto_dep_name = "topic",
proto_type_name = "ClassroomList",
name_prefix = "classroom_list",
proto_type_name = "ClassroomIdList",
name_prefix = "classroom_id_list",
asset_dir = "src/main/assets",
proto_dep_bazel_target_prefix = "//model/src/main/proto",
proto_package = "model",
) + generate_proto_binary_assets(
name = name,
names = classroom_file_names,
proto_dep_name = "topic",
proto_type_name = "ClassroomRecord",
name_prefix = "classroom_record",
asset_dir = "src/main/assets",
proto_dep_bazel_target_prefix = "//model/src/main/proto",
proto_package = "model",
Expand Down
2 changes: 2 additions & 0 deletions domain/src/main/assets/GJ2rLXRKD5hw.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"topic_name": "Fractions",
"topic_description": "You'll often need to talk about part of an object or group. For example, a jar of milk might be half-full, or some of the eggs in a box might have broken. In these lessons, you'll learn to use fractions to describe situations like these.",
"topic_id": "GJ2rLXRKD5hw",
"classroom_id": "test_classroom_id_1",
"classroom_name": "Maths",
"thumbnail_bg_color": "#000000",
"thumbnail_filename": "",
"skill_descriptions": {},
Expand Down
5 changes: 5 additions & 0 deletions domain/src/main/assets/GJ2rLXRKD5hw.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ translatable_description {
html: "You\'ll often need to talk about part of an object or group. For example, a jar of milk might be half-full, or some of the eggs in a box might have broken. In these lessons, you\'ll learn to use fractions to describe situations like these."
content_id: "description"
}
classroom_id: "test_classroom_id_1"
translatable_classroom_title {
html: "Maths"
content_id: "classroom_title"
}
11 changes: 1 addition & 10 deletions domain/src/main/assets/classrooms.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
{
"classrooms": [{
"id": "test_classroom_id_0",
"topic_prerequisites": {
"test_topic_id_0": ["GJ2rLXRKD5hw"],
"test_topic_id_1": ["test_topic_id_0", "omzF4oqgeTXd"],
"test_topic_id_2": [],
"GJ2rLXRKD5hw": [],
"omzF4oqgeTXd": []
}
}]
"classroom_id_list": ["test_classroom_id_0", "test_classroom_id_1", "test_classroom_id_2"]
}
34 changes: 3 additions & 31 deletions domain/src/main/assets/classrooms.textproto
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
classrooms {
id: "test_classroom_id_0"
topic_prerequisites {
key: "test_topic_id_0"
value {
topic_ids: "GJ2rLXRKD5hw"
}
}
topic_prerequisites {
key: "test_topic_id_1"
value {
topic_ids: "test_topic_id_0"
topic_ids: "omzF4oqgeTXd"
}
}
topic_prerequisites {
key: "test_topic_id_2"
value {
}
}
topic_prerequisites {
key: "GJ2rLXRKD5hw"
value {
}
}
topic_prerequisites {
key: "omzF4oqgeTXd"
value {
}
}
}
classroom_ids: "test_classroom_id_0"
classroom_ids: "test_classroom_id_1"
classroom_ids: "test_classroom_id_2"
2 changes: 2 additions & 0 deletions domain/src/main/assets/omzF4oqgeTXd.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"topic_name": "Ratios and Proportional Reasoning",
"topic_description": "Many everyday problems involve thinking about proportions. For example, if 30 apples cost 6 dollars, how much would 12 apples cost? In these lessons, you'll learn about how to use ratios and proportional reasoning to solve problems like this.",
"topic_id": "omzF4oqgeTXd",
"classroom_id": "test_classroom_id_1",
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
"classroom_name": "Maths",
"thumbnail_bg_color": "#000000",
"thumbnail_filename": "",
"skill_descriptions": {},
Expand Down
5 changes: 5 additions & 0 deletions domain/src/main/assets/omzF4oqgeTXd.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ translatable_description {
html: "Many everyday problems involve thinking about proportions. For example, if 30 apples cost 6 dollars, how much would 12 apples cost? In these lessons, you\'ll learn about how to use ratios and proportional reasoning to solve problems like this."
content_id: "description"
}
classroom_id: "test_classroom_id_1"
translatable_classroom_title {
html: "Maths"
content_id: "classroom_title"
}
13 changes: 13 additions & 0 deletions domain/src/main/assets/test_classroom_id_0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"classroom_id": "test_classroom_id_0",
"classroom_title": {
"content_id": "classroom_title",
"html": "Science"
},
"thumbnail_bg_color": "#00FFFFFF",
"thumbnail_filename": "",
"topic_prerequisites": {
"test_topic_id_0": ["GJ2rLXRKD5hw"],
"test_topic_id_1": ["test_topic_id_0", "omzF4oqgeTXd"]
}
}
20 changes: 20 additions & 0 deletions domain/src/main/assets/test_classroom_id_0.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
id: "test_classroom_id_0"
translatable_title {
content_id: "classroom_title"
html: "Science"
}
classroom_thumbnail {
}
topic_prerequisites {
key: "test_topic_id_0"
value {
topic_ids: "GJ2rLXRKD5hw"
}
}
topic_prerequisites {
key: "test_topic_id_1"
value {
topic_ids: "test_topic_id_0"
topic_ids: "omzF4oqgeTXd"
}
}
13 changes: 13 additions & 0 deletions domain/src/main/assets/test_classroom_id_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"classroom_id": "test_classroom_id_1",
"classroom_title": {
"content_id": "classroom_title",
"html": "Maths"
},
"thumbnail_bg_color": "#00FFFFFF",
"thumbnail_filename": "",
"topic_prerequisites": {
"GJ2rLXRKD5hw": [],
"omzF4oqgeTXd": []
}
}
17 changes: 17 additions & 0 deletions domain/src/main/assets/test_classroom_id_1.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
id: "test_classroom_id_1"
translatable_title {
content_id: "classroom_title"
html: "Maths"
}
classroom_thumbnail {
}
topic_prerequisites {
key: "GJ2rLXRKD5hw"
value {
}
}
topic_prerequisites {
key: "omzF4oqgeTXd"
value {
}
}
12 changes: 12 additions & 0 deletions domain/src/main/assets/test_classroom_id_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"classroom_id": "test_classroom_id_2",
"classroom_title": {
"content_id": "classroom_title",
"html": "English"
},
"thumbnail_bg_color": "#00FFFFFF",
"thumbnail_filename": "",
"topic_prerequisites": {
"test_topic_id_2": []
}
}
12 changes: 12 additions & 0 deletions domain/src/main/assets/test_classroom_id_2.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
id: "test_classroom_id_2"
translatable_title {
content_id: "classroom_title"
html: "English"
}
classroom_thumbnail {
}
topic_prerequisites {
key: "test_topic_id_2"
value {
}
}
2 changes: 2 additions & 0 deletions domain/src/main/assets/test_topic_id_0.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"topic_name": "First Test Topic",
"topic_description": "A topic investigating the interesting aspects of the Oppia Android app.",
"topic_id": "test_topic_id_0",
"classroom_id": "test_classroom_id_0",
"classroom_name": "Science",
"thumbnail_bg_color": "#000000",
"thumbnail_filename": "",
"skill_descriptions": {},
Expand Down
5 changes: 5 additions & 0 deletions domain/src/main/assets/test_topic_id_0.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ translatable_description {
html: "A topic investigating the interesting aspects of the Oppia Android app."
content_id: "description"
}
classroom_id: "test_classroom_id_0"
translatable_classroom_title {
html: "Science"
content_id: "classroom_title"
}
2 changes: 2 additions & 0 deletions domain/src/main/assets/test_topic_id_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"topic_name": "Second Test Topic",
"topic_description": "A topic considering the various implications of having especially long topic descriptions. These descriptions almost certainly need to wrap, which should be interesting in the UI (especially on small screens). Consider also that there may even be multiple points pertaining to a topic, some of which may require expanding the description section in order to read the whole topic description.",
"topic_id": "test_topic_id_1",
"classroom_id": "test_classroom_id_0",
"classroom_name": "Science",
"thumbnail_bg_color": "#000000",
"thumbnail_filename": "",
"skill_descriptions": {},
Expand Down
5 changes: 5 additions & 0 deletions domain/src/main/assets/test_topic_id_1.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@ translatable_description {
html: "A topic considering the various implications of having especially long topic descriptions. These descriptions almost certainly need to wrap, which should be interesting in the UI (especially on small screens). Consider also that there may even be multiple points pertaining to a topic, some of which may require expanding the description section in order to read the whole topic description."
content_id: "description"
}
classroom_id: "test_classroom_id_0"
translatable_classroom_title {
html: "Science"
content_id: "classroom_title"
}
2 changes: 2 additions & 0 deletions domain/src/main/assets/test_topic_id_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"topic_description": "A topic that's not yet ready to be played.",
"topic_name": "Third Test Topic",
"topic_id": "test_topic_id_2",
"classroom_id": "test_classroom_id_2",
"classroom_name": "English",
"version": -1,
"published": false,
"skill_descriptions": {},
Expand Down
5 changes: 5 additions & 0 deletions domain/src/main/assets/test_topic_id_2.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ translatable_description {
html: "A topic that\'s not yet ready to be played."
content_id: "description"
}
classroom_id: "test_classroom_id_2"
translatable_classroom_title {
html: "English"
content_id: "classroom_title"
}
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ class TopicController @Inject constructor(
putAllWrittenTranslations(topicRecord.writtenTranslationsMap)
title = topicRecord.translatableTitle
description = topicRecord.translatableDescription
classroomId = topicRecord.classroomId
BenHenning marked this conversation as resolved.
Show resolved Hide resolved
classroomTitle = topicRecord.translatableClassroomTitle
addAllStory(stories)
topicThumbnail = createTopicThumbnailFromProto(topicId, topicRecord.topicThumbnail)
diskSizeBytes = computeTopicSizeBytes(getProtoAssetFileNameList(topicId)).toLong()
Expand Down Expand Up @@ -554,6 +556,11 @@ class TopicController @Inject constructor(
contentId = "title"
html = topicData.getStringFromObject("topic_name")
}.build()
val classroomId = topicData.getStringFromObject("classroom_id")
val classroomTitle = SubtitledHtml.newBuilder().apply {
contentId = "classroom_title"
html = topicData.getStringFromObject("classroom_name")
}
val topicDescription = SubtitledHtml.newBuilder().apply {
contentId = "description"
html = topicData.getStringFromObject("topic_description")
Expand All @@ -562,6 +569,8 @@ class TopicController @Inject constructor(
return Topic.newBuilder()
.setTopicId(topicId)
.setTitle(topicTitle)
.setClassroomId(classroomId)
.setClassroomTitle(classroomTitle)
.setDescription(topicDescription)
.addAllStory(storySummaryList)
.setTopicThumbnail(createTopicThumbnailFromJson(topicData))
Expand Down
Loading
Loading