-
Notifications
You must be signed in to change notification settings - Fork 23
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
Task types #636
Task types #636
Conversation
Thanks for your contribution! Please, try to squash a few commits. |
For review it's easier to see the individual changes, so you can keep it like this for now. I'll try to take a look soon-ish. Thanks! |
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.
Thanks a lot for the PR! It looks really good, and would already provide value to us. I left some comments on things that I'd like to change.
api/views.py
Outdated
@@ -509,6 +509,9 @@ def set_subject(task): | |||
else: | |||
task.plagiarism_key = plagiarism_key[:255] | |||
|
|||
if data.get("type"): |
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.
If the type will be invalid, this will end in 500 server error. Let's check if the type is valid based on the TextChoices
values, and if not, return a proper 400 bad client request error.
Sorry, that was a small misunderstanding, we didn't necessarily want to have all the types from Edison, just wanted to point out which ones exist :) I would go for this set, to make it simpler than Edison:
I played with this locally a bit and I have to say that I'm a bit worried about the usage of the enum. It's quite strict and if we ever rename one of the fields or somehow wrong stuff appears in the DB, the server will not have a good time. We could work around that using I would just use a normal string, as we do for the existing enums (e.g. Day). With |
Okey, it was not specified, so i added all, but got it, will update that. About the enum thing, i didn't test it that much, but it was only proposed solution. After all the Enum is to my understanding just a wrapper around the choices, so i will change it. Is it a wanted feature to be able to leave a new task without a task type or to leave it blank. Or every new task created in the admin should have a type ? @Kobzol |
The enum was a good idea, but I worry that with our state of the database in Kelvin it would be a bit too easy to get into some weird state, and then the website would essentially become bricked until someone updated the DB manually to fix the invalid enum values 😅 We don't really create tasks in the admin, so it's not super important how it behaves there. For creating tasks on Kelvin, on the EditTask page, I would like to uphold the following rules:
Does that make sense? |
Makes sense. Will try to implement this behavior :). Thanks for the clarification. I wasn't sure where the task where being created, now that is clear. |
…tion, backend validation of the type
…tion, backend validation of the type
…tion, backend validation of the type
…tion, backend validation of the type
…tion, backend validation of the type
fcc40d5
to
7f63da2
Compare
Should be ready for merge now, squashed down into two main commits for backend and frontend. |
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.
Thank you! Left two minor comments, otherwise it looks pretty good :)
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.
Awesome work. Thank you very much! ❤️
Added Task types for possible sorting and grouping of the tasks. Enums are solved using a django_enums, could lead to easier comparison of enums.
Fixes: #578