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
-
new
submits tocreate_lead
-
create_lead
then creates the lead and applies the trial and successfully redirects
-
- A namespace has more than 1 possible namespace for trials
-
new
submits tocreate_lead
-
create_lead
then creates the lead -
create_lead
then redirects toselect
for user to select a namespace or create a new one -
select
then submits toapply
-
apply
then:- 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
-
new
submits tocreate
-
create
then creates the lead and applies the trial and successfully redirects
-
- A namespace has more than 1 possible namespace for trials
-
new
submits tocreate
-
create
then creates the lead -
create
then redirects tonew
for user to select a namespace or create a new one -
new
then submits tocreate
-
create
then:- either finds the namespace or creates it
- applies the trial
-
Tasks
-
Remove invalid
check on namespace when only 1 namespace exists/not creating one - !115678 (merged) -
Refactor create_lead
to make it the controller complexity clearer - !115678 (merged) -
Ensure test coverage for the create_lead
action - !115678 (merged) -
Refactor trial helper for correct code path - !117719 (merged) -
Refactor create_lead
method to user service class - !118382 (merged) -
Refactor apply
method to use service class - !119656 (merged) -
Remove need for separate select
action(convert to multi-step) - !115567 (merged) -
Remove need for separate apply
action(convert to multi-step) - !115567 (merged) -
Rename create_lead
action tocreate
- !115567 (merged) -
Follow-up on removed error tracking - #413701 (closed) -
Remove deprecated create_lead
/apply
methods - !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