Merge pull request #1031 from SKCwillie/issue1024

Updating MoveDetailSerializer to change $effect_chance to actual number
This commit is contained in:
Alessandro Pezzè 2024-02-19 19:53:55 +01:00 committed by GitHub
commit b5d617a52f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2343,6 +2343,12 @@ class MoveDetailSerializer(serializers.ModelSerializer):
data = MoveEffectEffectTextSerializer(
effect_texts, many=True, context=self.context
).data
if len(data) > 0:
for key, value in data[0].items():
if "$effect_chance%" in value:
data[0][key] = value.replace(
"$effect_chance", f"{obj.move_effect_chance}"
)
return data