diff --git a/src/apps/epic/migrations/0041_delete_stray_earthman_pentacles_courts.py b/src/apps/epic/migrations/0041_delete_stray_earthman_pentacles_courts.py new file mode 100644 index 0000000..fca616b --- /dev/null +++ b/src/apps/epic/migrations/0041_delete_stray_earthman_pentacles_courts.py @@ -0,0 +1,31 @@ +""" +Data migration: delete 4 stray Earthman court cards that were never cleaned up. + +Maid/Jack/Queen/King of Pentacles (suit=PENTACLES, arcana=MINOR, numbers 11-14) +are duplicates of the correct Maid/Jack/Queen/King of Crowns (suit=CROWNS, +arcana=MIDDLE) that already exist. The PENTACLES rows appeared before migration +0024 could catch them and were never removed. +""" +from django.db import migrations + + +def delete_stray_pentacles(apps, schema_editor): + TarotCard = apps.get_model("epic", "TarotCard") + DeckVariant = apps.get_model("epic", "DeckVariant") + earthman = DeckVariant.objects.filter(slug="earthman").first() + if not earthman: + return + TarotCard.objects.filter( + deck_variant=earthman, suit="PENTACLES", number__in=[11, 12, 13, 14], + ).delete() + + +class Migration(migrations.Migration): + + dependencies = [ + ("epic", "0040_rename_jovent_to_intent"), + ] + + operations = [ + migrations.RunPython(delete_stray_pentacles, migrations.RunPython.noop), + ] diff --git a/src/apps/gameboard/views.py b/src/apps/gameboard/views.py index dc6e02e..42c41ef 100644 --- a/src/apps/gameboard/views.py +++ b/src/apps/gameboard/views.py @@ -152,7 +152,8 @@ def tarot_fan(request, deck_id): deck = get_object_or_404(DeckVariant, pk=deck_id) if not request.user.unlocked_decks.filter(pk=deck_id).exists(): return HttpResponse(status=403) - _suit_order = {"WANDS": 0, "CUPS": 1, "SWORDS": 2, "PENTACLES": 3, "CROWNS": 3, "COINS": 4} + _suit_order = {"BRANDS": 0, "GRAILS": 1, "BLADES": 2, "CROWNS": 3, + "WANDS": 0, "CUPS": 1, "SWORDS": 2, "PENTACLES": 3} cards = sorted( TarotCard.objects.filter(deck_variant=deck), key=lambda c: (0 if c.arcana == "MAJOR" else 1, _suit_order.get(c.suit or "", 9), c.number),