-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix scoring for custom levels (#1624)
* fix scoring for custom levels * debug test * debug test * debug test * debug test * debug test * debug test * debug test * debug test * debug test * debug test * debug test * tidy code * tidy code pt 2 * Merge branch 'master' into fix--fix-algorithm-score-in-created-levels * address PR comments * debug test * debug test * try patching * debug test * address PR comments, fix test * add back line * add migration, remove redundant line * address PR comments * add property * fix typo * add log lines * debug test * debug test * test change to ajax url * revert changes used for testing
- Loading branch information
Showing
7 changed files
with
87 additions
and
34 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
28 changes: 28 additions & 0 deletions
28
game/migrations/0092_disable_algo_score_in_custom_levels.py
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_existing_custom_levels(apps: Apps, *args): | ||
Level = apps.get_model("game", "Level") | ||
|
||
Level.objects.filter( | ||
default=False | ||
).update(disable_algorithm_score=True) | ||
|
||
def enable_algo_score_for_existing_custom_levels(apps: Apps, *args): | ||
Level = apps.get_model("game", "Level") | ||
|
||
Level.objects.filter( | ||
default=False | ||
).update(disable_algorithm_score=False) | ||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("game", "0091_disable_algo_score_if_no_model_solution") | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
disable_algo_score_for_existing_custom_levels, | ||
reverse_code=enable_algo_score_for_existing_custom_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
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
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
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
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