From ad0d652bf602f75da11a5344d2210161df9b85a2 Mon Sep 17 00:00:00 2001 From: August Johnson Date: Sun, 4 Aug 2024 09:14:48 -0500 Subject: [PATCH] refactored fields to have _all suffix instead of all_ prefix. --- api_v2/models/speed.py | 2 +- api_v2/serializers/creature.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api_v2/models/speed.py b/api_v2/models/speed.py index c3afbec9..e01fb6c4 100644 --- a/api_v2/models/speed.py +++ b/api_v2/models/speed.py @@ -60,7 +60,7 @@ def get_speed(self): return speed - def get_all_speed(self): + def get_speed_all(self): return { "unit": self.get_unit(), "walk": self.walk, diff --git a/api_v2/serializers/creature.py b/api_v2/serializers/creature.py index 85682204..bb2c26f3 100644 --- a/api_v2/serializers/creature.py +++ b/api_v2/serializers/creature.py @@ -104,13 +104,13 @@ class CreatureSerializer(GameContentSerializer): ability_scores = serializers.SerializerMethodField() modifiers = serializers.SerializerMethodField() saving_throws = serializers.SerializerMethodField() - all_saving_throws = serializers.SerializerMethodField() + saving_throws_all = serializers.SerializerMethodField() skill_bonuses = serializers.SerializerMethodField() - all_skill_bonuses = serializers.SerializerMethodField() + skill_bonuses_all = serializers.SerializerMethodField() actions = serializers.SerializerMethodField() size = SizeSerializer(read_only=True, context={'request': {}}) speed = serializers.SerializerMethodField() - all_speed = serializers.SerializerMethodField() + speed_all = serializers.SerializerMethodField() challenge_rating_text = serializers.SerializerMethodField() experience_points = serializers.SerializerMethodField() @@ -125,7 +125,7 @@ class Meta: 'name', 'size', 'speed', - 'all_speed', + 'speed_all', 'category', 'type', 'alignment', @@ -139,9 +139,9 @@ class Meta: 'ability_scores', 'modifiers', 'saving_throws', - 'all_saving_throws', + 'saving_throws_all', 'skill_bonuses', - 'all_skill_bonuses', + 'skill_bonuses_all', 'passive_perception', 'damage_immunities', 'nonmagical_attack_immunity', @@ -171,7 +171,7 @@ def get_saving_throws(self, creature): entries = creature.get_saving_throws().items() return { key: value for key, value in entries if value is not None } - def get_all_saving_throws(self, creature): + def get_saving_throws_all(self, creature): '''Implicit saving throws helper method.''' defaults = creature.get_modifiers() entries = creature.get_saving_throws().items() @@ -182,7 +182,7 @@ def get_skill_bonuses(self, creature): entries = creature.get_skill_bonuses().items() return { key: value for key, value in entries if value is not None } - def get_all_skill_bonuses(self, creature): + def get_skill_bonuses_all(self, creature): '''Implicit skill bonuses helper method.''' defaults = { 'acrobatics': creature.modifier_dexterity, @@ -212,9 +212,9 @@ def get_speed(self, creature): entries = creature.get_speed().items() return { key: value for key, value in entries if value is not None } - def get_all_speed(self, creature): + def get_speed_all(self, creature): '''Implicit speed helper method.''' - return creature.get_all_speed() + return creature.get_speed_all() def get_actions(self, creature): '''Actions helper method.'''