From c9f01a7836e40cd365997dbb93b613cdbf513322 Mon Sep 17 00:00:00 2001 From: Stefan Kairinos Date: Thu, 15 Feb 2024 10:32:01 +0000 Subject: [PATCH] fix: rename episodes and levels (#1581) * fix: rename episodes and levels * feedback * fix: remove whitespaces --- game/messages.py | 54 ++++++++++++------------ game/migrations/0088_rename_episodes.py | 35 +++++++++++++++ game/templates/game/level_selection.html | 2 +- 3 files changed, 63 insertions(+), 28 deletions(-) create mode 100644 game/migrations/0088_rename_episodes.py diff --git a/game/messages.py b/game/messages.py index 263b4ba10..2ff4e962d 100644 --- a/game/messages.py +++ b/game/messages.py @@ -527,7 +527,7 @@ def hint_level19(): def title_level20(): - return "Use the Repeat block to make your sequence shorter and simpler" + return "Use the repeat block to make your sequence shorter and simpler" def description_level20(): @@ -773,7 +773,7 @@ def hint_level31(): def title_level32(): - return "Uh oh, it's Until fever!" + return "Uh oh, it's until fever!" def description_level32(): @@ -790,7 +790,7 @@ def hint_level32(): def title_level33(): - return "Now it's time to try the If block" + return "Now it's time to try the if block" def description_level33(): @@ -819,7 +819,7 @@ def hint_level33(): def title_level34(): - return "Multiple Ifs" + return "Multiple ifs" def description_level34(): @@ -868,7 +868,7 @@ def hint_level35(): def title_level36(): - return "What else? If-else if-else, that's what!" + return "What else? If-else, that's what!" def description_level36(): @@ -1226,7 +1226,7 @@ def hint_level51(): def title_level52(): - return "A Bit more Tricky" + return "A bit more tricky" def description_level52(): @@ -1265,7 +1265,7 @@ def hint_level53(): def title_level54(): - return "Round and Round" + return "Round and round" def description_level54(): @@ -1284,7 +1284,7 @@ def hint_level54(): def title_level55(): - return "Wonky Fish!" + return "Wonky fish!" def description_level55(): @@ -1300,7 +1300,7 @@ def hint_level55(): def title_level56(): - return "Concrete Wasteland" + return "Concrete wasteland" def description_level56(): @@ -1319,7 +1319,7 @@ def hint_level56(): def title_level57(): - return "This is not... the same" + return "This is not... the same" def description_level57(): @@ -1418,7 +1418,7 @@ def hint_level61(): def title_level62(): - return "Lots of Traffic Lights!" + return "Lots of traffic lights!" def description_level62(): @@ -1435,7 +1435,7 @@ def hint_level62(): def title_level63(): - return "Wiggle Wiggle" + return "Wiggle wiggle" def description_level63(): @@ -1456,7 +1456,7 @@ def hint_level63(): def title_level64(): - return "Muddy Patterns with Phil" + return "Muddy patterns with Phil" def description_level64(): @@ -1513,7 +1513,7 @@ def hint_level66(): def title_level67(): - return "Crazy Farm" + return "Crazy farm" def description_level67(): @@ -1596,7 +1596,7 @@ def hint_level71(): def title_level72(): - return "Can Wes Find his lunch?" + return "Can Wes find his lunch?" def description_level72(): @@ -1676,7 +1676,7 @@ def hint_level76(): def title_level77(): - return "G Force" + return "G force" def description_level77(): @@ -1710,7 +1710,7 @@ def hint_level78(): def title_level79(): - return "Muddy Mayhem" + return "Muddy mayhem" def description_level79(): @@ -1815,7 +1815,7 @@ def hint_level83(): def title_level84(): - return "Repeat and watch" + return "Repeat and watch" def description_level84(): @@ -1832,7 +1832,7 @@ def hint_level84(): def title_level85(): - return "Looks easy but use repeat until and see what happens?" + return "Looks easy but use repeat until and see what happens?" def description_level85(): @@ -1850,7 +1850,7 @@ def hint_level85(): def title_level86(): - return "See what the if blocks looks like in Python" + return "See what the if blocks looks like in Python" def description_level86(): @@ -1866,7 +1866,7 @@ def hint_level86(): def title_level87(): - return "Don't forget to use else if" + return "Don't forget to use else if" def description_level87(): @@ -1883,7 +1883,7 @@ def hint_level87(): def title_level88(): - return "See what happens when you add Traffic lights" + return "See what happens when you add traffic lights" def description_level88(): @@ -2172,7 +2172,7 @@ def hint_level100(): def title_level101(): - return "Function or Junction?" + return "Function or junction?" def description_level101(): @@ -2459,7 +2459,7 @@ def hint_level109(): description_level116, hint_level116, ) = ( - lambda: "In a while, crocodile!", + lambda: "In a while, crocodile!", lambda: build_description( title_level116(), "This level may look easy, but this time you need to use a While Loop to deliver to the house." @@ -2474,7 +2474,7 @@ def hint_level109(): description_level117, hint_level117, ) = ( - lambda: "Wiggle while you work", + lambda: "Wiggle while you work", lambda: build_description( title_level117(), "This time it's a little harder. We've added the directions back in." @@ -2886,8 +2886,8 @@ def get_episode_title(episode_id): 9: "Blockly Brain Teasers", 10: "Introduction to Python", 11: "Python", - 12: "Sequencing and Counted Loops", - 13: "Indeterminate WHILE Loops - coming soon", + 12: "Counted Loops Using While", + 13: "Indeterminate While Loops - coming soon", 14: "Selection in a Loop - coming soon", 15: "For Loops - coming soon", } diff --git a/game/migrations/0088_rename_episodes.py b/game/migrations/0088_rename_episodes.py new file mode 100644 index 000000000..9e45611ca --- /dev/null +++ b/game/migrations/0088_rename_episodes.py @@ -0,0 +1,35 @@ +from django.apps.registry import Apps +from django.db import migrations + + +def rename_episodes(apps: Apps, *args): + Episode = apps.get_model("game", "Episode") + + def update_episode_name(pk: int, name: str): + episode = Episode.objects.get(pk=pk) + episode.name = name + episode.save() + + update_episode_name(pk=12, name="Counted Loops Using While") + update_episode_name(pk=13, name="Indeterminate While Loops - coming soon") + + +def undo_rename_episodes(apps: Apps, *args): + Episode = apps.get_model("game", "Episode") + + def update_episode_name(pk: int, name: str): + episode = Episode.objects.get(pk=pk) + episode.name = name + episode.save() + + update_episode_name(pk=12, name="Sequencing and Counted Loops") + update_episode_name(pk=13, name="Indeterminate WHILE Loops - coming soon") + +class Migration(migrations.Migration): + dependencies = [("game", "0087_workspace_python_view_enabled")] + operations = [ + migrations.RunPython( + rename_episodes, + reverse_code=undo_rename_episodes, + ) + ] diff --git a/game/templates/game/level_selection.html b/game/templates/game/level_selection.html index 002d29d52..e455f5905 100644 --- a/game/templates/game/level_selection.html +++ b/game/templates/game/level_selection.html @@ -113,7 +113,7 @@

Blockly levels

{% if episode.random_levels_enabled %}

- Random: Try your hand at a random level. + Random: Try your hand at a random level

{% endif %}