-
Notifications
You must be signed in to change notification settings - Fork 45
adding new phase in competition fixed #963
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
Conversation
|
@bbearce Hi Benjamin, would you have a chance to review and test this PR? |
|
When I add a new phase, then the editor's Note that I selected the right start and end dates, and put the phase in the right order. Here are the logs I get: codabench-django-1 | Internal Server Error: /api/competitions/12/
codabench-django-1 | Traceback (most recent call last):
codabench-django-1 | File "/usr/local/lib/python3.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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.8/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 221, in update
codabench-django-1 | auto_migrate_to_this_phase=phase["auto_migrate_to_this_phase"],
codabench-django-1 | KeyError: 'auto_migrate_to_this_phase'
codabench-django-1 | File "/usr/local/lib/python3.8/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 221, in update
codabench-django-1 | auto_migrate_to_this_phase=phase["auto_migrate_to_this_phase"],
codabench-django-1 | KeyError: 'auto_migrate_to_this_phase' |
Latest commit has solved this issue |
|
But now we have this error in CircleCI: E django.db.utils.IntegrityError: duplicate key value violates unique constraint "leaderboards_column_leaderboard_id_key_aa81662d_uniq"
E DETAIL: Key (leaderboard_id, key)=(7, nature) already exists.
/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py:84: IntegrityError=========================== short test summary info ============================
FAILED src/apps/api/tests/test_competitions.py::CompetitionResultDatatypesTests::test_get_competition_leaderboard_as_json
===== 1 failed, 167 passed, 9 deselected, 89 warnings in 84.84s (0:01:24) ====== |
|
I don't know why it failed but rerunning the test fixed the failure :D |
|
To check
Yes phase is deleted with competition |
|
Depending on the order and dates of phase, I still have the same problem: nothing happens when I click on save. First testI put the newly created phase as the oldest (top of the list), with start and end dates before the next phase. It saves and work fine. Second testI put the newly created phase as the newest (bottom of the list), with a starting date and no end date. I edit the dates of the other phases so they start and finish before the newly created phase. This DOES NOT save. |
Isn't it a bit concerning that it failed in the first place? |
It seems that the issue was because of an entry in the db. Not sure what exactly caused it |
|
More tests: I have a competition with 2 phases:
Adding two phases to this competiiton: one before phase 1 and one after phase 2
@Didayolo I think everything is working. Can you try once more with a fresh branch and with collectstatic. |
|
In my case, the last phase was "never ending" before I changed the dates. Maybe the problem comes from that? It was a fresh deployement with collect static. |
i will check this condition too |
|
@Didayolo Final phase has no end date. And when i add a phase after that, I get this error which seems reasonable. What do you think?
|
OK, so I was exactly in this situation, and updated
So the warning disappear but then the |
|
@Didayolo that was a nice catch. Now last phase can have no end date. |
|
The fix is a nice catch too! |






@ mention of reviewers
@Didayolo
A brief description of the purpose of the changes contained in this PR.
Now users can add new phase in a competition
Issues this PR resolves
Checklist