app/services/c100_app/navigation_stack.rb
# This method serves two purposes, related one with another:
#
#   1. Set a session flag if a page is visited through the CYA `change` link,
#      so we can return the user back to the CYA again if possible, but only
#      if they've already completed all the steps (thus the funnel).
#
#   2. Update the `navigation_stack` record attribute, used for the `back` links.
#      Only if the above session flag is not set, otherwise we would be wiping
#      parts of the navigation stack when using the "fast forward" functionality.
#
This method serves two purposes, related one with another:
1. Set a session flag if a page is visited through the CYA `change` link,
so we can return the user back to the CYA again if possible, but only
if they've already completed all the steps (thus the funnel).

2. Update the `navigation_stack` record attribute, used for the `back` links.
Only if the above session flag is not set, otherwise we would be wiping
parts of the navigation stack when using the "fast forward" functionality.
This method serves two purposes related one with another : 1 . Set a session flag if a page is visited through the CYA ` change ` link so we can return the user back to the CYA again if possible but only if they ' ve already completed all the steps ( thus the funnel ) . 2 . Update the ` navigation_stack ` record attribute used for the ` back ` links . Only if the above session flag is not set otherwise we would be wiping parts of the navigation stack when using the " fast forward " functionality .
def update!
      session[:cya_origin] = CYA_FUNNEL.eql?(
        c100_application.navigation_stack.last(CYA_FUNNEL.size)
      )
      return if fast_forward_to_cya?
      stack_until_current_page = c100_application.navigation_stack.take_while { |path| !path.eql?(current_path) }
      c100_application.navigation_stack = stack_until_current_page + [current_path]
      c100_application.save!(touch: false)
    end
def update! session [ :cya_origin ] = CYA_FUNNEL . eql? ( c100_application . navigation_stack . last ( CYA_FUNNEL . size ) ) return if fast_forward_to_cya? stack_until_current_page = c100_application . navigation_stack . take_while { | path | ! path . eql? ( current_path ) } c100_application . navigation_stack = stack_until_current_page + [ current_path ] c100_application . save! ( touch : false ) end
This method serves two purposes, related one with another:
1.
This method serves two purposes related one with another : 1 .