lib/avalon/workflow/workflow_datastream.rb
def advance
	lcs = (last_completed_step.is_a? Array) ? last_completed_step.first : last_completed_step

	if (lcs.blank? or not HYDRANT_STEPS.exists?(lcs))
	  Rails.logger.warn "<< Step #{lcs} invalid, defaulting to first step >>"
	  self.last_completed_step = HYDRANT_STEPS.first.step
	elsif (not HYDRANT_STEPS.last?(lcs))
	  next_step = HYDRANT_STEPS.next(lcs).step
	  Rails.logger.debug "<< Advancing to the next step - #{next_step} >>"
          self.last_completed_step = next_step 
        end
      end
# Advance should recognize that a step is invalid and respond by 
# defaulting to the first known step. If you are already on the last
# step then don't advance any further. There's a potential for silently
# failing here but this is a first pass only
Advance should recognize that a step is invalid and respond by
defaulting to the first known step. If you are already on the last
step then don't advance any further. There's a potential for silently
failing here but this is a first pass only
Advance should recognize that a step is invalid and respond by defaulting to the first known step . If you are already on the last step then don ' t advance any further . There ' s a potential for silently failing here but this is a first pass only
def advance
	lcs = (last_completed_step.is_a? Array) ? last_completed_step.first : last_completed_step
	if (lcs.blank? or not HYDRANT_STEPS.exists?(lcs))
	  Rails.logger.warn "<< Step #{lcs} invalid, defaulting to first step >>"
	  self.last_completed_step = HYDRANT_STEPS.first.step
	elsif (not HYDRANT_STEPS.last?(lcs))
	  next_step = HYDRANT_STEPS.next(lcs).step
	  Rails.logger.debug "<< Advancing to the next step - #{next_step} >>"
          self.last_completed_step = next_step 
        end
      end
def advance lcs = ( last_completed_step . is_a? Array ) ? last_completed_step . first : last_completed_step if ( lcs . blank? or not HYDRANT_STEPS . exists? ( lcs ) ) Rails . logger . warn "<< Step #{lcs} invalid, defaulting to first step >>" self . last_completed_step = HYDRANT_STEPS . first . step elsif ( not HYDRANT_STEPS . last? ( lcs ) ) next_step = HYDRANT_STEPS . next ( lcs ) . step Rails . logger . debug "<< Advancing to the next step - #{next_step} >>" self . last_completed_step = next_step end end
Advance should recognize that a step is invalid and respond by
defaulting to the first known step.
Advance should recognize that a step is invalid and respond by defaulting to the first known step .