-
Notifications
You must be signed in to change notification settings - Fork 809
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
Add submission cancel feature #3456
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add the screenshot of the UI?
apps/jobs/urls.py
Outdated
@@ -110,6 +110,11 @@ | |||
views.update_submission_started_at, | |||
name="update_submission_started_at", | |||
), | |||
url( | |||
r"^challenge/(?P<challenge_pk>[0-9]+)/submissions/(?P<submission_pk>[0-9]+)/cancel/$", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need challenge_pk
here? I think submission_pk
should be enough here, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only want the participants of the team to cancel the submission using UI. To check whether team has participated in the challenge we need challenge pk
apps/jobs/urls.py
Outdated
@@ -110,6 +110,11 @@ | |||
views.update_submission_started_at, | |||
name="update_submission_started_at", | |||
), | |||
url( | |||
r"^challenge/(?P<challenge_pk>[0-9]+)/submissions/(?P<submission_pk>[0-9]+)/cancel/$", | |||
views.change_submission_status_to_cancel, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create a generic API that changes the status of the submissions to other status as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is specific to the user functionality of cancelling submission. Why should this API be allowed to set other statuses?
apps/jobs/views.py
Outdated
""" | ||
API Endpoint for setting submission status to CANCELLED. | ||
""" | ||
print(request.user, challenge_pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the print statement here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ram81 Can you please remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ram81 ?
apps/jobs/views.py
Outdated
""" | ||
API Endpoint for setting submission status to CANCELLED. | ||
""" | ||
print(request.user, challenge_pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ram81 Can you please remove it?
apps/jobs/views.py
Outdated
) | ||
|
||
try: | ||
participant_team = ParticipantTeam.objects.get(pk=participant_team_pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please use/create get_participant_model
like we have for challenges/challenge phases.
apps/jobs/views.py
Outdated
participant_team=participant_team, | ||
) | ||
except Submission.DoesNotExist: | ||
response_data = {"error": "Submission does not exist"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{"error": "Submission {} does not exist".format(submission_pk)}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apps/jobs/views.py
Outdated
) | ||
except Submission.DoesNotExist: | ||
response_data = {"error": "Submission does not exist"} | ||
return Response(response_data, status=status.HTTP_403_FORBIDDEN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be 404 , no?
apps/jobs/views.py
Outdated
""" | ||
API Endpoint for setting submission status to CANCELLED. | ||
""" | ||
print(request.user, challenge_pk) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Ram81 ?
apps/jobs/views.py
Outdated
participant_team=participant_team, | ||
) | ||
except Submission.DoesNotExist: | ||
response_data = {"error": "Submission does not exist"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Add submission cancel feature * Rebase changes * Remove unused code * Fix reviews * Fix review Co-authored-by: Rishabh Jain <[email protected]>
Description
This PR adds -
SUBMITTED