Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Altering leaderboard columns breaks a live contest. No additional saves can be made #1600

Open
chansmi opened this issue Sep 27, 2024 · 4 comments
Labels

Comments

@chansmi
Copy link

chansmi commented Sep 27, 2024

I was working with Ihsan and we made changes to the leaderboard columns. Specifically removing the columns. Everthing seemed to work properly but not I can't make any changes to the site. Trying to save any changes, even small, results in the following console error.

Live contest: https://www.codabench.org/competitions/edit/3888/#/pages

Screenshot 2024-09-27 at 4 09 36 PM

@Didayolo
Copy link
Collaborator

Here are the error logs when trying to save.

codabench-django-1         | Internal Server Error: /api/competitions/3888/
codabench-django-1         | Traceback (most recent call last):
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
codabench-django-1         |     response = get_response(request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
codabench-django-1         |     response = self.process_exception_by_middleware(e, request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
codabench-django-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
codabench-django-1         |     return view_func(*args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 116, in view
codabench-django-1         |     return self.dispatch(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 495, in dispatch
codabench-django-1         |     response = self.handle_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 455, in handle_exception
codabench-django-1         |     self.raise_uncaught_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 492, in dispatch
codabench-django-1         |     response = handler(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/mixins.py", line 84, in partial_update
codabench-django-1         |     return self.update(request, *args, **kwargs)
codabench-django-1         |   File "/app/src/apps/api/views/competitions.py", line 262, in update
codabench-django-1         |     leaderboard.save()
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/drf_writable_nested/mixins.py", line 230, in save
codabench-django-1         |     return super(BaseNestedModelSerializer, self).save(**kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 183, in save
codabench-django-1         |     assert not self.errors, (
codabench-django-1         | AssertionError: You cannot call `.save()` on a serializer with invalid data.
codabench-django-1         | Internal Server Error: /api/competitions/3888/
codabench-django-1         | Traceback (most recent call last):
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 34, in inner
codabench-django-1         |     response = get_response(request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 115, in _get_response
codabench-django-1         |     response = self.process_exception_by_middleware(e, request)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 113, in _get_response
codabench-django-1         |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
codabench-django-1         |     return view_func(*args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/viewsets.py", line 116, in view
codabench-django-1         |     return self.dispatch(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 495, in dispatch
codabench-django-1         |     response = self.handle_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 455, in handle_exception
codabench-django-1         |     self.raise_uncaught_exception(exc)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/views.py", line 492, in dispatch
codabench-django-1         |     response = handler(request, *args, **kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/mixins.py", line 84, in partial_update
codabench-django-1         |     return self.update(request, *args, **kwargs)
codabench-django-1         |   File "/app/src/apps/api/views/competitions.py", line 262, in update
codabench-django-1         |     leaderboard.save()
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/drf_writable_nested/mixins.py", line 230, in save
codabench-django-1         |     return super(BaseNestedModelSerializer, self).save(**kwargs)
codabench-django-1         |   File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 183, in save
codabench-django-1         |     assert not self.errors, (
codabench-django-1         | AssertionError: You cannot call `.save()` on a serializer with invalid data.

@Didayolo
Copy link
Collaborator

The first column "Avg Focal Per Capita" was previously set as an average between the two other columns.
When you removed the two other columns, this computation was missing its columns and the setting got invalid.
I replaced the "Average" mode by simply calling an "avg_focal_per_capita" key for this column.

Not sure if you want to have the two other columns and compute an average, or to use this key as I did right now.
The key "avg_focal_per_capita" means that the scoring program must output a score associated with this key.

It is now possible to make live changes and to save the competition.

@Didayolo
Copy link
Collaborator

Regarding this issue, it should not have been possible to save the leaderboard setting after removed columns used by a "computation column".

@Didayolo Didayolo changed the title Urgent: Altering leaderboard columns breaks a live contest. No additional saves can be made Altering leaderboard columns breaks a live contest. No additional saves can be made Sep 27, 2024
@Didayolo
Copy link
Collaborator

I need to detail the issue but basically there is a strange behavior here:

  1. I set up the column to use key instead of computation
  2. Save
  3. Come back to the editor and the column is using computation again

@Didayolo Didayolo added the Bug label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants