-
-
Notifications
You must be signed in to change notification settings - Fork 127
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
Rework nominations #447
Rework nominations #447
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.
I ran out of time for now, but I'm a few commits in. I've just gone over the code as of now and I wanted to give my feedback early, rather than late, as I'm not sure when I'll have time again.
Things I haven't reviewed yet:
- Grammar
- Functional test
As a general comment: None of the commit messages I've read have a meaningful commit message body and some of the titles are a bit too long. Ideally, a commit message should explain the what and why of the change you're committing to the history instead of having just a single summary line.
Some of these commits are fairly sizeable and you've made a number of choices within those commits; try to add the reasoning behind those choices into the commit message body so that reasoning becomes part of the git history of the repository.
These are few links @lemonsaurus typically shares when talking about commit messages:
https://chris.beams.io/posts/git-commit/
https://thoughtbot.com/blog/5-useful-tips-for-a-better-commit-message
http://ablogaboutcode.com/2011/03/23/proper-git-commit-messages-and-an-elegant-git-history
https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
A more extreme example: https://dhwthompson.com/2019/my-favourite-git-commit
This page is also really nice: https://mtlynch.io/code-review-love/
In order to use entries in serializer without manually setting entries key we have to use related_name option to automatically fetch all related entries.
Set it here so we don't have to set it every place where we fetch entries.
This doesn't make sense to have 3 small migrations for one PR, so I merged 2 existing migrations and 1 new, ordering and related_name adding migrations to one.
After setting related_name in NominationEntry model nomination field, we can just provide serializer and DRF automatically fetch all related entries.
After moving entries to nomination serializer we can get rid from GET request handlers and let DRF handle this. Also PATCH and POST handlers got some simplification by removing manual entries setting.
Entries isn't handled manually anymore so these tests have no point.
For string fields NULL as default is not suggested, so use empty string instead.
I've looked over the new schema, and from a functional standpoint, it seems good. Here are the old vs new schemas if anyone wants to compare (you can play around with it 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.
I'm mostly okay with this PR. There are grammar issues, but it looks like it does what it needs to do.
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.
Mainly grammar + code style fixes, but otherwise looks good.
Co-authored-by: Leon Sandøy <leon.haland@gmail.com> Co-authored-by: Joe Banks <joseph@josephbanks.me>
Co-authored-by: Joe Banks <joseph@josephbanks.me>
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.
A few more
Note! This HAVE to be merged EXACTLY the same time as bot PR
Changes
Instead of one nominations table, there are now 2 tables: Nominations and nomination entries. The nominations table got one new field
reviewed
(boolean). Here are schemas of these tables:Now is also allowed multiple nominations per-user and they are created as nomination entries. One user can create only 1 entry for each nomination.
Also updated tests to match with all these changes.
What to test?
reviewed
field setting works?Closes #445