Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Rename some methods

Roland Geider9627e2d2fd0c
diff --git a/wger/manager/api/views.py b/wger/manager/api/views.py
index 666cbf3dc..fca28e257 100644
--- a/wger/manager/api/views.py
+++ b/wger/manager/api/views.py
@@ -157,7 +157,7 @@ class RoutineViewSet(viewsets.ModelViewSet):
"""
Return full object structure of the routine.
"""
- cache_key = CacheKeyMapper.get_routine_api_structure_key(pk)
+ cache_key = CacheKeyMapper.routine_api_structure_key(pk)
cached_data = cache.get(cache_key)
if cached_data is not None:
return Response(cached_data)
@@ -186,7 +186,7 @@ class RoutineViewSet(viewsets.ModelViewSet):
"""
Returns the logs for the routine
"""
- cache_key = CacheKeyMapper.get_routine_api_stats(pk)
+ cache_key = CacheKeyMapper.routine_api_stats(pk)
cached_data = cache.get(cache_key)
if cached_data is not None:
return Response(cached_data)
diff --git a/wger/manager/helpers.py b/wger/manager/helpers.py
index 93c76b1cf..d2a050328 100644
--- a/wger/manager/helpers.py
+++ b/wger/manager/helpers.py
@@ -185,11 +185,11 @@ def render_workout_day(
def reset_routine_cache(instance: Routine):
"""Resets all caches related to a routine"""
- cache.delete(CacheKeyMapper.get_routine_date_sequence_key(instance.id))
+ cache.delete(CacheKeyMapper.routine_date_sequence_key(instance.id))
cache.delete(CacheKeyMapper.routine_api_date_sequence_display_key(instance.id))
cache.delete(CacheKeyMapper.routine_api_date_sequence_gym_key(instance.id))
- cache.delete(CacheKeyMapper.get_routine_api_structure_key(instance.id))
- cache.delete(CacheKeyMapper.get_routine_api_stats(instance.id))
+ cache.delete(CacheKeyMapper.routine_api_structure_key(instance.id))
+ cache.delete(CacheKeyMapper.routine_api_stats(instance.id))
if instance.pk:
for day in instance.days.all():
diff --git a/wger/manager/models/routine.py b/wger/manager/models/routine.py
index 0c70cc65d..9c5ef11e8 100644
--- a/wger/manager/models/routine.py
+++ b/wger/manager/models/routine.py
@@ -181,7 +181,7 @@ class Routine(models.Model):
If a day needs logs to continue it will be repeated until the user adds one.
"""
- cache_key = CacheKeyMapper.get_routine_date_sequence_key(self.id)
+ cache_key = CacheKeyMapper.routine_date_sequence_key(self.id)
cached_data = cache.get(cache_key)
if cached_data is not None:
return cached_data
diff --git a/wger/utils/cache.py b/wger/utils/cache.py
index 3ecd7e1b5..6a1e4c467 100644
--- a/wger/utils/cache.py
+++ b/wger/utils/cache.py
@@ -90,7 +90,7 @@ class CacheKeyMapper:
return f'base-uuid-{base_uuid}'
@classmethod
- def get_routine_date_sequence_key(cls, id: int):
+ def routine_date_sequence_key(cls, id: int):
return f'routine-date-sequence-{id}'
@classmethod
@@ -102,11 +102,11 @@ class CacheKeyMapper:
return f'routine-api-date-sequence-gym-{pk}'
@classmethod
- def get_routine_api_stats(cls, pk: int):
+ def routine_api_stats(cls, pk: int):
return f'routine-api-stats-{pk}'
@classmethod
- def get_routine_api_structure_key(cls, pk: int):
+ def routine_api_structure_key(cls, pk: int):
return f'routine-api-structure-{pk}'
@classmethod