Skip to content

Commit

Permalink
fix: wrong card art for Duos
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Apr 16, 2024
1 parent 852872b commit 2a2a258
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions twitch_hdt_ebs/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ class PubSubMessageSerializer(serializers.Serializer):
data = serializers.DictField()
version = serializers.IntegerField(default=0)

def validate_data(self, data):
game_type = data.get("game_type")
player = data.get("player", {})
player_deck = player.get("deck", {})

if (
# Fake Duos -> BGT_BATTLEGROUNDS to ensure the Twitch Extension fetches Battlegrounds renders (with tier
# icons), until we can update the extension frontend.
game_type in (65, 66, 67, 68) or
# Temporary workaround for HDT not sending the right Duos game type (can be removed after HDT v1.25.4)
(game_type == 0 and player_deck.get("size") == 0)
):
data["game_type"] = 50

return data


class IntegerFieldStoredAsCharField(serializers.IntegerField):
def to_internal_value(self, data):
Expand Down

0 comments on commit 2a2a258

Please sign in to comment.