-
Notifications
You must be signed in to change notification settings - Fork 82
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
Api improvements #373
base: master
Are you sure you want to change the base?
Api improvements #373
Conversation
I have a concern: if there is an onsite contest with ip authentication enabled is it possible to submit as someone else with their api key? |
Probably all API endpoints should check (maybe with |
This is not something related to this issue, as we have not changed anything about submission endpoint. |
@@ -637,3 +635,47 @@ def has_view_permission(self, request, obj=None): | |||
return True | |||
|
|||
return ArchivedInlineWrapper | |||
|
|||
|
|||
def get_problem_statements(request, controller, problem_instances): |
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 would be a nightmare to maintain this, what about returning list of dicts?
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 elaborate please?
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.
In this function you return tuple with very specific order of tuple-elements. This ordering is repeated in two distinct places and the code would fail if they will be out-of-sync.
I suggest to have a get_problem_statements(..) that returns a list of dictionaries i.e.
[
{"problem_instance": pi1, "statement_visible": True, "round_end_time": datetime(...), ...},
{"problem_instance": pi2, "statement_visible": False, "round_end_time": datetime(...), ...},
...
]
With this change you still need to maintain sync between different fragments of code, but at least you will get an error in case of mispelled key.
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.
Other than this change I'm happy to merge the PR.
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 handle the comments.
This is a draft PR showcasing current functionality implemented in the API. In terms of problems it allows for:
Currently, yet to be implemented is querying a submission list, a ranking, writing tests and request limitation.
VSCode Extension
This issue is being worked on in parallel with a VSCode extension, that already allows to submit solutions right from the editor. What a time to be alive!