在取得 round 的 leaderboard 時出現 UnboundLocalError: cannot access local variable 'total_score' where it is not associated with a value
OS Version
Linux
提供相關的 log 輸出 Relevant log output
aceback (most recent call last):
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/contrib/staticfiles/handlers.py", line 80, in __call__
return self.application(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/wsgi.py", line 124, in __call__
response = self.get_response(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/base.py", line 140, in get_response
response = self._middleware_chain(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/exception.py", line 57, in inner
response = response_for_exception(request, exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/exception.py", line 140, in response_for_exception
response = handle_uncaught_exception(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/exception.py", line 181, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django_extensions/management/technical_response.py", line 40, in null_technical_500_response
raise exc_value.with_traceback(tb)
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
return self.dispatch(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/home/andrew/.cache/pypoetry/virtualenvs/equipment-backend-P9fZ2XNv-py3.12/lib/python3.12/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andrew/Projects/Drawing-Competition-Backend/api/views/statistic.py", line 196, in get
d["total_score"] = total_score
^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'total_score' where it is not associated with a value
行為準則 Code of Conduct
[X] 我同意本專案的行為準則 I agree to follow this project's Code of Conduct
Contact Details
No response
發生了甚麼? What happened?
在取得 round 的 leaderboard 時出現 UnboundLocalError: cannot access local variable 'total_score' where it is not associated with a value
OS Version
Linux
提供相關的 log 輸出 Relevant log output
行為準則 Code of Conduct