Open teovin opened 2 weeks ago
Attention: Patch coverage is 87.60331%
with 15 lines
in your changes missing coverage. Please review.
Project coverage is 69.28%. Comparing base (
1c1fd71
) to head (2d59d57
). Report is 2 commits behind head on develop.
Files with missing lines | Patch % | Lines |
---|---|---|
perma_web/perma/views/user_management.py | 70.73% | 12 Missing :warning: |
perma_web/perma/forms.py | 96.20% | 3 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
🚨 Try these New Features:
Reviewing this with @bensteinberg (running locally), we noticed a few minor details with the CSV handling form.
@christiansmith @bensteinberg Pushed a couple of commits for the desired behavior and also added a test. I am checking with Clare about below to see what her preference would be. My initial approach was that it is good to process the good data and ignore the rest, as in something is better than nothing if it makes sense. Will check with Becky on the point of running a single db query.
It might also make sense to fail if there are any validation errors, rather than create some users and not others.
@christiansmith @bensteinberg I made some changes to the PR since you last looked, I'd appreciate it if you could look again. Clare preferred to process the valid users and notify the requestor for those that were invalid, and I updated the PR description and UI messaging to reflect that.
This feature adds a new button to the organization user management view (/manage/organization-users):
Upon clicking, the bulk upload form comes up:
User makes the organization, affiliation expiration, and CSV file selections. Form cannot be submitted without an organization selection or with a non .csv file extension.
It is also invalid if it doesn't include all of the column headers, if it doesn't have any users at all, if it doesn't include the email data for a given user and also if it has duplicate users.
The affiliation field can be toggled just like in the single user flow.
Once submitted, users that don't exist will be created; those that do will have their organization affiliation updated. New users will receive new user email with account activation email. Existing users will receive the user added to organization email.
A generic success message will be displayed at the end if there are no validation errors:
If some of the users get processed, but some can't due to those being an admin or registrar, below will be displayed:
If all users in the CSV are admins or registrars, the below error message will be displayed:
This PR also fixes a bug where the existing user email wasn't displaying the organization name.
Disclaimer: Any behavior and the wording here are open to feedback. This was my initial take on it :)
EDIT:
As of Nov 20th, I put this feature behind a feature flag so we can do some more testing on it in stage before a possible production deployment.