-
Notifications
You must be signed in to change notification settings - Fork 73
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
Tiny tweaks to form processing #3673
Tiny tweaks to form processing #3673
Conversation
…y new/existing users.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3673 +/- ##
===========================================
+ Coverage 69.05% 69.67% +0.62%
===========================================
Files 54 54
Lines 7493 7661 +168
===========================================
+ Hits 5174 5338 +164
- Misses 2319 2323 +4 ☔ View full report in Codecov by Sentry. |
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.
Looks good to me. I left a few comments about minor points of coding style; feel free to adopt or ignore as you prefer.
Co-authored-by: cmsetzer <[email protected]>
Co-authored-by: cmsetzer <[email protected]>
Co-authored-by: cmsetzer <[email protected]>
This PR makes just a few tweaks to the how the new form for adding many users to an organization at a time saves data.
it adjusts when
if commit
is checked, so that all the logic except for the actual write operations is run ifcommit
isFalse
it creates new
OrganizationAffiliation
objects all together in one batch, instead of two batches (one for brand new users and one for existing users)when retrieving the collection of existing affiliation objects, it uses
select_related('user')
, so that later, when runningset(affiliation.user for affiliation in preexisting_affiliations)
, each call toaffiliation.user
does not trigger a separate call to the databaseit adjusts how we handle potentially mixed/uppercase and cast-to-lowercase email addresses so that a) duplicate emails are detected in the CSV even if they differ in casing, and b) we can retrieve the raw email address from
self.user_data
I took the liberty of renaming a few variables, adding a few comments, and slightly changing the order of operations, so that existing users are handled first, and then we move on to new users.