app/services/c100_app/abuse_concerns_decision_tree.rb
# Note: this is a lot of branching but makes for a more readable code, and is easier to
# change the ordering. It could be refactored once we have the abuse details step.
#
this is a lot of branching but makes for a more readable code, and is easier to
change the ordering. It could be refactored once we have the abuse details step.
this is a lot of branching but makes for a more readable code and is easier to change the ordering . It could be refactored once we have the abuse details step .
def questions_destination(subject)
      case abuse_kind
      when AbuseType::SEXUAL
        edit(:question, subject: subject, kind: AbuseType::PHYSICAL)
      when AbuseType::PHYSICAL
        edit(:question, subject: subject, kind: AbuseType::FINANCIAL)
      when AbuseType::FINANCIAL
        edit(:question, subject: subject, kind: AbuseType::PSYCHOLOGICAL)
      when AbuseType::PSYCHOLOGICAL
        edit(:question, subject: subject, kind: AbuseType::EMOTIONAL)
      when AbuseType::EMOTIONAL
        edit(:question, subject: subject, kind: AbuseType::OTHER)
      else
        raise InvalidStep, "Unknown abuse kind: #{abuse_kind}"
      end
    end
def questions_destination ( subject ) case abuse_kind when AbuseType :: SEXUAL edit ( :question , subject : subject , kind : AbuseType :: PHYSICAL ) when AbuseType :: PHYSICAL edit ( :question , subject : subject , kind : AbuseType :: FINANCIAL ) when AbuseType :: FINANCIAL edit ( :question , subject : subject , kind : AbuseType :: PSYCHOLOGICAL ) when AbuseType :: PSYCHOLOGICAL edit ( :question , subject : subject , kind : AbuseType :: EMOTIONAL ) when AbuseType :: EMOTIONAL edit ( :question , subject : subject , kind : AbuseType :: OTHER ) else raise InvalidStep , "Unknown abuse kind: #{abuse_kind}" end end
Note: this is a lot of branching but makes for a more readable code, and is easier to
change the ordering.
Note : this is a lot of branching but makes for a more readable code and is easier to change the ordering .
subject