#1788 Add mobile number column to system imports for supervisors#3335
Conversation
|
|
||
| if supervisor_params.key?(:phone_number) | ||
| if supervisor_params[:phone_number].length != VALID_PHONE_NUMBER_LENGTH || !supervisor_params[:phone_number].scan(/\D/).empty? | ||
| raise "Phone number is not in correct format" |
There was a problem hiding this comment.
Specify correct format in error
There was a problem hiding this comment.
Added as "Phone number is not in correct format: 1XXXXXXXXXX"!
|
Some strange tests failing, I'm not sure what could have gone wrong there... |
xihai01
left a comment
There was a problem hiding this comment.
For your supervisor_import.rb file, I see that you are making validations for the phone number. But would it be better to handle these validations in the User model instead? Since volunteer, supervisor and admin all inherit from the User model and each of these users will need the same validations for phone numbers too.
https://guides.rubyonrails.org/active_record_validations.html#length
@xihai01 Yes, this is a great point. I will make this change which will also help us bring the |
@compwron Yea not really sure what's happening here either as the |
xihai01
left a comment
There was a problem hiding this comment.
looks good to me and smart use of custom validators.
|
🥇 |
What github issue is this PR for, if any?
Resolves #1788
What changed, and why?
Userdata model to store phone number as astringsupervisor_importerto include new column for phone numbers and validating the inputs in each rowFakerHow will this affect user permissions?
How is this tested? (please write tests!) 💖💪
Screenshots please :)
Valid Input:

Invalid Input:
Input

Error File
