Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Solved bug in download-exercise-images.py task

Leninuxf68333b03af1
diff --git a/AUTHORS.rst b/AUTHORS.rst
index e0a6c34c9..5f345d15b 100644
--- a/AUTHORS.rst
+++ b/AUTHORS.rst
@@ -57,6 +57,7 @@ Developers
* Calvin Walden - https://github.com/calvinrw
* Jack Mulligan - https://github.com/jackmulligan-ire
* Kristopher Newsome - https://github.com/sysadmin75
+* Leninux - https://github.com/RedRudeBoy
Translators
-----------
diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.py
index 82c31fb47..bed9f3e86 100644
--- a/wger/exercises/management/commands/download-exercise-images.py
+++ b/wger/exercises/management/commands/download-exercise-images.py
@@ -96,12 +96,6 @@ class Command(BaseCommand):
self.stdout.write('')
self.stdout.write(f'*** Page {page}')
self.stdout.write('')
- page += 1
-
- if result['next']:
- result = requests.get(result['next'], headers=headers).json()
- else:
- all_images_processed = True
for image_data in result['results']:
image_uuid = image_data['uuid']
@@ -144,3 +138,9 @@ class Command(BaseCommand):
)
image.save()
self.stdout.write(self.style.SUCCESS(' successfully saved'))
+
+ if result['next']:
+ page += 1
+ result = requests.get(result['next'], headers=headers).json()
+ else:
+ all_images_processed = True