-
-
Save benhamill/4068222 to your computer and use it in GitHub Desktop.
Conditional organization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Option 1 | |
if eea_exists? | |
if eea_uses_something? | |
if eea_ever_used_application? | |
if eea_currently_uses_application? | |
recreate_eea; reactivate_application_for_eea; create_session; #13S | |
else | |
recreate_eea; reactivate_application_for_eea; create_session; #13S | |
end | |
else | |
recreate_eea; activate_application_for_eea; create_session; #9S | |
end | |
elsif eea_ever_used_application? | |
recreate_eea; reactivate_application_for_eea; create_session; #10S | |
else | |
recreate_eea; activate_application_for_eea; create_session; #11S | |
end | |
else | |
create_user_and_eea; activate_application_for_eea; create_session; #8S | |
end | |
# Option 2 | |
if !eea_exists? | |
create_user_and_eea; activate_application_for_eea; create_session; #8S | |
elsif eea_exists? && !eea_uses_something? && !eea_ever_used_application? | |
recreate_eea; activate_application_for_eea; create_session; #11S | |
elsif eea_exists? && !eea_uses_something? && eea_ever_used_application? | |
recreate_eea; reactivate_application_for_eea; create_session; #10S | |
elsif eea_exists? && eea_uses_something? && !eea_ever_used_application? | |
recreate_eea; activate_application_for_eea; create_session; #9S | |
elsif eea_exists? && eea_uses_something? && eea_ever_used_application? && !eea_currently_uses_application? | |
recreate_eea; reactivate_application_for_eea; create_session; #13S | |
elsif eea_exists? && eea_uses_something? && eea_ever_used_application? && eea_currently_uses_application? | |
recreate_eea; create_session; #12S | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_up | |
if eea_exists? | |
check_existing_user | |
else | |
# 8S | |
create_user_and_eea | |
activate_application_for_eea | |
create_session | |
end | |
end | |
def check_existing_user | |
if eea_uses_something? | |
check_existing_application_usage | |
else | |
check_not_existing_application_usage | |
end | |
end | |
def check_existing_application_usage | |
if eea_ever_used_application? | |
check_current_application_usage | |
else | |
# 9S | |
recreate_eea | |
activate_application_for_eea | |
create_session | |
end | |
end | |
def check_not_existing_application_usage | |
if eea_ever_used_application? | |
# 10S | |
recreate_eea | |
reactivate_application_for_eea | |
create_session | |
else | |
# 11S | |
recreate_eea | |
activate_application_for_eea | |
create_session | |
end | |
end | |
def check_current_application_usage | |
if eea_currently_uses_application? | |
# 12S | |
recreate_eea | |
create_session | |
else | |
# 13S | |
recreate_eea | |
reactivate_application_for_eea | |
create_session | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment