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

Sign in redirects follow up #25248

Merged
merged 5 commits into from
Oct 5, 2018
Merged

Sign in redirects follow up #25248

merged 5 commits into from
Oct 5, 2018

Conversation

Erin007
Copy link
Contributor

@Erin007 Erin007 commented Oct 4, 2018

Incorporating feedback from #25218.

return current_user.most_recent_progress_in_recently_assigned_script? || current_user.last_assignment_after_most_recent_progress?
else
return true
end
Copy link
Contributor

Choose a reason for hiding this comment

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

If your first if-expression is false this method returns nil instead of true or false, which doesn't break behavior but is a little messy.

This method could also be expressed as a single expression. I think this is equivalent:

def should_redirect_to_script_overview?
  current_user.student? &&
  !account_takeover_in_progress &&
  current_user.most_recently_assigned_user_script &&
  (
    !current_user.user_script_with_most_recent_progress || 
    current_user.most_recent_progress_in_recently_assigned_script? || 
    current_user.last_assignment_after_most_recent_progress?
  )
end

Copy link
Contributor

@islemaster islemaster 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 the cleanup!

@Erin007 Erin007 merged commit 9347360 into staging Oct 5, 2018
@Erin007 Erin007 deleted the sign-in-redirects-follow-up branch October 5, 2018 03:10
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.

None yet

2 participants