-
Notifications
You must be signed in to change notification settings - Fork 33
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
Completed First Ruby Asg - Ming #7
base: master
Are you sure you want to change the base?
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.
Great Job Ming!
def generate_username (first, last, year, p_level = 0) | ||
|
||
# put in variable for easy reference | ||
new_username = format_name(first,last) + year.to_s[-2, year.to_s.length-1] |
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.
You have a method to format the year!
new_username = format_name(first,last) + format_year(year)
end | ||
|
||
def user_type_prefix (num) | ||
if num == 0 |
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 getting some code smell - you've already written this code before. How can you refactor this code by calling the check_privilege method?
# registered user name, if match, add '_count' to new_username, update count | ||
# and then push into increment_name list associated with that matched user | ||
# and then return that incremented name as output | ||
if $users[0] == nil |
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.
Great solution!
21/22
Didnt attempt the "remove special characters in strings (BONUS)" for format_name. Everything else i got it down. Probably just need some googling of doing regex