Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove all comments and aliases and recreate them when synchronizing (and correctly only save the aliases, not the whole json object!!)

Roland Geiderfc6ea9896bd4
diff --git a/wger/exercises/sync.py b/wger/exercises/sync.py
index 3bf147f00..d8d23febb 100644
--- a/wger/exercises/sync.py
+++ b/wger/exercises/sync.py
@@ -122,14 +122,16 @@ def sync_exercises(
f"{translation.language.short_name} {trans_uuid} - {name}"
print_fn(out)
+ ExerciseComment.objects.filter(exercise=translation).delete()
for note in translation_data['notes']:
ExerciseComment.objects.get_or_create(
exercise=translation,
comment=note['comment'],
)
+ Alias.objects.filter(exercise=translation).delete()
for alias in translation_data['aliases']:
- Alias.objects.get_or_create(exercise=translation, alias=alias)
+ Alias.objects.get_or_create(exercise=translation, alias=alias['alias'])
print_fn('')