-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94bd745
commit d2f2a9c
Showing
3 changed files
with
69 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.apps.registry import Apps | ||
from django.db import migrations | ||
|
||
|
||
def disable_algo_score_for_python_levels(apps: Apps, *args): | ||
Level = apps.get_model("game", "Level") | ||
|
||
Level.objects.filter(default=True, blocklyEnabled=False).update( | ||
disable_algorithm_score=True | ||
) | ||
|
||
|
||
def enable_algo_score_for_python_levels(apps: Apps, *args): | ||
Level = apps.get_model("game", "Level") | ||
|
||
Level.objects.filter(default=True, blocklyEnabled=False).update( | ||
disable_algorithm_score=False | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [("game", "0089_episodes_in_development")] | ||
operations = [ | ||
migrations.RunPython( | ||
disable_algo_score_for_python_levels, | ||
reverse_code=enable_algo_score_for_python_levels, | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.apps.registry import Apps | ||
from django.db import migrations | ||
|
||
|
||
def set_successful_python_attempts_to_10(apps: Apps, *args): | ||
Attempt = apps.get_model("game", "Attempt") | ||
|
||
Attempt.objects.filter( | ||
level__default=True, level__blocklyEnabled=False, | ||
level__disable_algorithm_score=True, score=20 | ||
).update(score=10) | ||
|
||
|
||
def set_successful_python_attempts_to_20(apps: Apps, *args): | ||
Attempt = apps.get_model("game", "Attempt") | ||
|
||
Attempt.objects.filter( | ||
level__default=True, level__blocklyEnabled=False, | ||
level__disable_algorithm_score=True, score=10 | ||
).update(score=20) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [("game", "0090_python_levels_no_algo_score")] | ||
operations = [ | ||
migrations.RunPython( | ||
set_successful_python_attempts_to_10, | ||
reverse_code=set_successful_python_attempts_to_20, | ||
) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters