Skip to content
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

Add bulk import users from emails #1640

Merged
merged 16 commits into from
Nov 20, 2022
Merged

Add bulk import users from emails #1640

merged 16 commits into from
Nov 20, 2022

Conversation

victorhuangwq
Copy link
Contributor

@victorhuangwq victorhuangwq commented Nov 10, 2022

Description

Adds ability to create users from bulk using just email.

Adds:

  • UI to add emails and assigned role in bulk
  • Frontend validation
  • Validation, creation of account (if doesn't exist), and assigning of roles

image

Motivation and Context

Creating accounts individually for adding CAs and Instructors is tedious for class with of them (~40).

How Has This Been Tested?

Tested Valid Inputs:

Tested Invalid Inputs:

  • Single entry: dave, assigned as instructor (error message of invalid email)
  • Single entry: dave@test.com, no assigned role (error message of assigned role)
  • All wrong entries: dave, test@@.com, greg, dave <test@g (shows which entries are wrong)
  • Mix of correct and wrong: dave, dave@test.com, greg (shows which entries are wrong)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

Other issues / help required

If unsure, feel free to submit first and we'll help you along.

@@ -229,6 +229,63 @@ def users
end
end

action_auth_level :add_users_from_emails, :instructor
def add_users_from_emails
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@michellexliu Since you worked with roster upload, before I continue further, could you take a quick look at the logic below?

@victorhuangwq victorhuangwq changed the title [WIP] Add bulk import email Add bulk import users from emails Nov 12, 2022
@damianhxy
Copy link
Member

Screenshot 2022-11-16 at 00 32 43

For the first invalid input, I get a different error message

Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality works as expected, but left some comments.

As an additional nit, I realized that I can't press arrow up / down in the text area -- not sure if that was intended.

app/assets/javascripts/course_users.js Outdated Show resolved Hide resolved
app/assets/javascripts/course_users.js Outdated Show resolved Hide resolved
app/controllers/courses_controller.rb Outdated Show resolved Hide resolved
app/controllers/courses_controller.rb Show resolved Hide resolved
app/controllers/courses_controller.rb Outdated Show resolved Hide resolved
app/controllers/courses_controller.rb Outdated Show resolved Hide resolved
Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments

Other than a comment about error message consistency, LGTM!

app/assets/javascripts/course_users.js Outdated Show resolved Hide resolved
@victorhuangwq
Copy link
Contributor Author

victorhuangwq commented Nov 18, 2022

Tested with:
firstName <firstname@name.com>
firstName lastName <firstlastname@name.com>
firstName M lastName <firstmlastname@name.com>
image

@victorhuangwq
Copy link
Contributor Author

@damianhxy do a last check review on the cases above. Thanks!

@damianhxy
Copy link
Member

Tested cases as working.

However, it's a bit weird that we're ignoring middle names altogether. Should we lump it with first names?

@victorhuangwq
Copy link
Contributor Author

Currently the roster upload doesn't support middle name as well. So I think it's logical to just drop the middle name to be consistent.

@victorhuangwq victorhuangwq merged commit faec258 into master Nov 20, 2022
@victorhuangwq victorhuangwq deleted the add-bulk-import-email branch November 20, 2022 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants