Skip to content

Commit

Permalink
Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Sep 6, 2024
1 parent f39f113 commit c2a1e50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 6 additions & 6 deletions game/migrations/0102_reoder_episodes_13_14.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def swap_episodes_13_14(apps: Apps, *args):
episode12 = Episode.objects.get(pk=12)
episode13 = Episode.objects.get(pk=13)
episode14 = Episode.objects.get(pk=14)
episode15 = Episode.objects.get(pk=15)
episode20 = Episode.objects.get(pk=20)

episode13_levels = Level.objects.filter(
default=True, name__in=range(1026, 1041)
Expand Down Expand Up @@ -45,7 +45,7 @@ def swap_episodes_13_14(apps: Apps, *args):

episode12.next_episode = episode13
episode13.next_episode = episode14
episode14.next_episode = episode15
episode14.next_episode = episode20

episode12.save()
episode13.save()
Expand All @@ -57,7 +57,7 @@ def swap_episodes_13_14(apps: Apps, *args):

episode12_last_level.next_level = episode13.level_set.all()[0]
episode13_last_level.next_level = episode14.level_set.all()[0]
episode14_last_level.next_level = episode15.level_set.all()[0]
episode14_last_level.next_level = None

episode12_last_level.save()
episode13_last_level.save()
Expand All @@ -71,7 +71,7 @@ def unswap_episodes_13_14(apps: Apps, *args):
episode12 = Episode.objects.get(pk=12)
episode13 = Episode.objects.get(pk=13)
episode14 = Episode.objects.get(pk=14)
episode15 = Episode.objects.get(pk=15)
episode20 = Episode.objects.get(pk=20)

episode13_levels = Level.objects.filter(
default=True, name__in=range(1014, 1026)
Expand Down Expand Up @@ -107,7 +107,7 @@ def unswap_episodes_13_14(apps: Apps, *args):

episode12.next_episode = episode14
episode14.next_episode = episode13
episode13.next_episode = episode15
episode13.next_episode = episode20

episode12.save()
episode13.save()
Expand All @@ -119,7 +119,7 @@ def unswap_episodes_13_14(apps: Apps, *args):

episode12_last_level.next_level = episode14.level_set.all()[0]
episode14_last_level.next_level = episode13.level_set.all()[0]
episode13_last_level.next_level = episode14.level_set.all()[0]
episode13_last_level.next_level = None

episode12_last_level.save()
episode13_last_level.save()
Expand Down
4 changes: 3 additions & 1 deletion game/views/level_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_blockly_episodes(request):

def get_python_episodes(request):
return fetch_episode_data(
app_settings.EARLY_ACCESS_FUNCTION(request), 16, 15
app_settings.EARLY_ACCESS_FUNCTION(request), 16, 22
)


Expand Down Expand Up @@ -249,6 +249,8 @@ def levels(request, language):
elif language == "python":
python_episodes = get_python_episodes(request)

print(python_episodes)

for episode in python_episodes:
for level in episode["levels"]:
attach_attempts_to_level(attempts, level)
Expand Down

0 comments on commit c2a1e50

Please sign in to comment.