Simplify current new trial creation methods
Summary
Currently the actions in the trials_controller have more than 2 possible branches. We should simplify the controller layer so that we are at max 2 branches in the controller layer per action.
Currently we have a multi-step form hiding between many actions of create_lead/select/apply
Current trial flows
- A namespace has only 1 possible namespace for trials
-
newsubmits tocreate_lead -
create_leadthen creates the lead and applies the trial and successfully redirects
-
- A namespace has more than 1 possible namespace for trials
-
newsubmits tocreate_lead -
create_leadthen creates the lead -
create_leadthen redirects toselectfor user to select a namespace or create a new one -
selectthen submits toapply -
applythen:- either finds the namespace or creates it
- applies the trial
-
Plan
Simplify down to a new and create action and utilize multi-step concepts to drive lead or trial creation.
New Trial flows
Core change is that new will replace functionality of select and create will replace functionality of apply. This will allow us to more clearly see the process as right now it is not clear that select and apply are the tail end processes coming from new.
- A namespace has only 1 possible namespace for trials
-
newsubmits tocreate -
createthen creates the lead and applies the trial and successfully redirects
-
- A namespace has more than 1 possible namespace for trials
-
newsubmits tocreate -
createthen creates the lead -
createthen redirects tonewfor user to select a namespace or create a new one -
newthen submits tocreate -
createthen:- either finds the namespace or creates it
- applies the trial
-
Tasks
-
Remove invalidcheck on namespace when only 1 namespace exists/not creating one - !115678 (merged) -
Refactor create_leadto make it the controller complexity clearer - !115678 (merged) -
Ensure test coverage for the create_leadaction - !115678 (merged) -
Refactor trial helper for correct code path - !117719 (merged) -
Refactor create_leadmethod to user service class - !118382 (merged) -
Refactor applymethod to use service class - !119656 (merged) -
Remove need for separate selectaction(convert to multi-step) - !115567 (merged) -
Remove need for separate applyaction(convert to multi-step) - !115567 (merged) -
Rename create_leadaction tocreate- !115567 (merged) -
Follow-up on removed error tracking - #413701 (closed) -
Remove deprecated create_lead/applymethods - !122219 (merged) -
Investigate use of memoization in TrialsHelper#trial_eligible_namespaces- #413704 (closed) -
Follow-up on no message at all after submitting for a trial - #413700 (closed)
Edited by Doug Stull