wger-project / docker

Production...ish docker-compose image for wger
GNU Affero General Public License v3.0
139 stars 48 forks source link

Added new exercise - untranslated - now have a broken install. "An error occurred" #72

Open ranasats opened 11 months ago

ranasats commented 11 months ago

Hi,

Looking through logs I see this message:

wger_server  | System check identified some issues:
wger_server  | 
wger_server  | WARNINGS:
wger_server  | ?: (wger.W002) exercises without translations
wger_server  |  HINT: There are 1 exercises without translations, this will cause problems! You can output or delete them with "python manage.py exercises-health-check --help"

I did the following after looking through the docs:

docker exec web python3 manage.py exercises-health-check --delete-untranslated

This throws an error:


INFO 2023-12-11 02:57:19,945 apps AXES: BEGIN version 6.1.1, blocking by ip_address
System check identified some issues:

WARNINGS:
?: (wger.W002) exercises without translations
        HINT: There are 1 exercises without translations, this will cause problems! You can output or delete them with "python manage.py exercises-health-check --help"
Exercise a97ba0cb-8077-4e08-8590-3328e1dfdcd5 has no translations!
Traceback (most recent call last):
  File "/home/wger/src/manage.py", line 25, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
  File "/home/wger/src/wger/exercises/management/commands/exercises-health-check.py", line 91, in handle
    self.handle_untranslated(base, delete_untranslated)
  File "/home/wger/src/wger/exercises/management/commands/exercises-health-check.py", line 104, in handle_untranslated
    base.delete()
  File "/home/wger/src/wger/exercises/models/base.py", line 254, in delete
    comment=f"Exercise base of {self.get_exercise(ENGLISH_SHORT_NAME).name}",
AttributeError: 'NoneType' object has no attribute 'name'

So essentially I now have a broken install, I can't do anything (add new workouts, templates, exercises, etc).

How can I remove the new exercise I just added? Also, how do I prevent this in the future, just add a 'fake' translation?

Thanks!

ranasats commented 11 months ago

Deleted my database (brand new install, so nothing lost) and tried again. This time I added a 'fake' spanish translation which was just the same text again but this time under "spanish".

Same error as above has happened. Not sure how I can go about adding a new exercise... Any tips? I did notice as soon as I hit submit on the new exercise, the button that says "submit exercise" greys out and I get an error on my log:

wger_server | WARNING 2023-12-11 10:47:30,442 log Bad Request: /api/v2/exercise-translation/

And then the usual error that's called above shows up whenever i try to remove the untranslated exercise.