-
Notifications
You must be signed in to change notification settings - Fork 31
feat/add-entry-exclusion-subtlety #4206
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b6cf2b8
feat/add-entry-exclusion-subtlety
lsabor 92036da
undo lock update
lsabor 0d2b02e
remove eslint new dependency
lsabor 1a7a0fb
fix formatting
lsabor 9d789c3
Merge branch 'main' of github.com:Metaculus/metaculus into feat/add-e…
lsabor ed09144
fix migration conflict
lsabor 52b9321
edit help text
lsabor 59d10e1
fix bugs, address comments
lsabor 056359c
address more coments
lsabor 85662a6
remove unused return
lsabor 4592ebc
sp deprecate
lsabor 6a6f839
Merge branch 'main' of github.com:Metaculus/metaculus into feat/add-e…
lsabor 4c35d14
change implementation overall
lsabor 5572736
admin improvements
lsabor 9420c8b
address comments
lsabor 4e8ec6a
Merge branch 'main' into feat/add-entry-exclusion-subtlety
cemreinanc e8fdf7c
support bot_status assignment in migration, order leaderboard entries…
lsabor 58d2bb5
fix failing update F reference
lsabor 4a701fd
remove unused import
lsabor b3bb851
Merge branch 'main' of github.com:Metaculus/metaculus into feat/add-e…
lsabor 5f2101b
resolve merge conflicts, address two minor comments
lsabor 3728aca
exclude prize only takes rank
lsabor c0b63b7
Merge branch 'main' of github.com:Metaculus/metaculus into feat/add-e…
lsabor 53688fe
Merge branch 'main' of github.com:Metaculus/metaculus into feat/add-e…
lsabor 96bcaea
improve inline exclusion handling features
lsabor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
102 changes: 102 additions & 0 deletions
102
scoring/migrations/0021_leaderboardentry_and_medalexclusionrecord_exclusion_status.py
This file contains hidden or 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,102 @@ | ||
| # Generated by Django 5.1.15 on 2026-01-31 15:26 | ||
|
|
||
| from django.db import migrations, models | ||
| from django.db.models import BooleanField, Case, IntegerField, Value, When | ||
|
|
||
|
|
||
| def migrate(apps, schema_editor): | ||
| LeaderboardEntry = apps.get_model("scoring", "LeaderboardEntry") | ||
| LeaderboardEntry.objects.update( | ||
| exclusion_status=Case( | ||
| When(excluded=False, then=Value(0)), # "Include" | ||
| When(show_when_excluded=True, then=Value(2)), # "Exclude and Show" | ||
| default=Value(4), # "Exclude" | ||
| output_field=IntegerField(), | ||
| ) | ||
| ) | ||
| MedalExclusionRecord = apps.get_model("scoring", "MedalExclusionRecord") | ||
| MedalExclusionRecord.objects.update( | ||
| exclusion_status=Case( | ||
| When(show_anyway=True, then=Value(2)), # "Exclude and Show" | ||
| default=Value(4), # "Exclude" | ||
| output_field=IntegerField(), | ||
| ) | ||
| ) | ||
|
|
||
|
|
||
| def reverse_migrate(apps, schema_editor): | ||
| LeaderboardEntry = apps.get_model("scoring", "LeaderboardEntry") | ||
| # All values between include and exclude map to: | ||
| # excluded = True | ||
| # show_when_excluded = True | ||
| LeaderboardEntry.objects.update( | ||
| excluded=Case( | ||
| When(exclusion_status=0, then=Value(False)), # "Include" | ||
| default=Value(True), | ||
| output_field=BooleanField(), | ||
| ), | ||
| show_when_excluded=Case( | ||
| When(exclusion_status=4, then=Value(False)), # "Exclude" | ||
| default=Value(True), | ||
| output_field=BooleanField(), | ||
| ), | ||
| ) | ||
| MedalExclusionRecord = apps.get_model("scoring", "MedalExclusionRecord") | ||
| MedalExclusionRecord.objects.update( | ||
| show_anyway=Case( | ||
| When(exclusion_status=4, then=Value(False)), # "Exclude" | ||
| default=Value(True), | ||
| output_field=BooleanField(), | ||
| ), | ||
| ) | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("scoring", "0020_leaderboard_display_config"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="leaderboardentry", | ||
| name="exclusion_status", | ||
| field=models.IntegerField( | ||
| choices=[ | ||
| (0, "Include"), | ||
| (1, "Exclude Prize And Show"), | ||
| (2, "Exclude And Show"), | ||
| (3, "Exclude And Show In Advanced"), | ||
| (4, "Exclude"), | ||
| ], | ||
| default=0, | ||
| help_text="""This sets the exclusion status of this entry. | ||
| </br>- (0) Include: shows entry & takes rank and prize. | ||
| </br>- (1) Exclude Prize and Show: shows entry, takes rank, but excludes from prizes | ||
| </br>- (2) Exclude and Show: shows entry, but excludes from rank and prizes | ||
| </br>- (3) Exclude and Show in Advanced: only shows entry in advanced views, excludes from rank and prizes | ||
| </br>- (4) Exclude: excludes entry from showing, rank, and prizes""", | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="medalexclusionrecord", | ||
| name="exclusion_status", | ||
| field=models.IntegerField( | ||
| choices=[ | ||
| (0, "Include"), | ||
| (1, "Exclude Prize And Show"), | ||
| (2, "Exclude And Show"), | ||
| (3, "Exclude And Show In Advanced"), | ||
| (4, "Exclude"), | ||
| ], | ||
| default=4, | ||
| help_text="""This sets the exclusion status of this entry. | ||
| </br>- (0) Include: shows entry & takes rank and prize. | ||
| </br>- (1) Exclude Prize and Show: shows entry, takes rank, but excludes from prizes | ||
| </br>- (2) Exclude and Show: shows entry, but excludes from rank and prizes | ||
| </br>- (3) Exclude and Show in Advanced: only shows entry in advanced views, excludes from rank and prizes | ||
| </br>- (4) Exclude: excludes entry from showing, rank, and prizes""", | ||
| ), | ||
| ), | ||
| migrations.RunPython(migrate, reverse_code=reverse_migrate), | ||
| ] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.