Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependent questions within Repeater groups do not show appropriately. #366

Open
stgallagher opened this issue Sep 24, 2012 · 2 comments
Open
Labels

Comments

@stgallagher
Copy link

Questions within a repeater group have an underscore-row-number attached to their identifier indicating the level of repetition (e.g. q_485 becomes q_485_0 for the first row). When a dependency is attached to a question within a repeater group, satisfaction of the dependency takes the question identifier from the "hide" set in the put request, to the "show" set, but the question identifier does not have the appended row level, so the question does not show.

For example:

SURVEYOR CODE:

repeater do

q_initial_question "Independent question",
:pick => :one
a_1 "Yes"
a_2 "No"
a_5 "Other"

q_following_question "dependent question",
:pick => ::one
a_1 "Yes"
a_2 "No"
dependency :rule => "A"
condition_A :q_initial_question, "==", :a_5

end

BROWSER:

q_initial_question ID = q_485_0

q_following_question ID = q_486_0

Action:

Select "a_1" from "q_initial_question"

Console => PUT - {"show":["q_485"],"hide":["q_486"]}

STATUS - q_following_question is appropriately hidden

Select "a_5" from "q_initial_question"

Console => PUT - {"show":["q_485", "q_486"],"hide":[]}

STATUS - q_following_question is still hidden, even though dependency is satisfied

@rsutphin
Copy link
Contributor

It looks to me like dependency evaluation doesn't take response_group into account. It seems like we'll need to handle two situations:

  • When the dependent question is inside the same repeating group as the deciding question, dependencies should be evaluated within the scope of the same response group only.
  • When the dependent question is inside a repeating group but the deciding question is not, the dependencies should be evaluated for all response groups.

(For the third and fourth possibilities — a deciding question inside a repeating group with the dependent question outside or in a different repeater — I don't know what the proper behavior would be, so I'm in favor of leaving it undefined.)

@yoon
Copy link
Member

yoon commented Dec 21, 2012

An example from #235

    q_CIG_NOW_NUM "On days that you smoke, how many cigarettes do you smoke per day? If you smoke 1 cigarette or 
    less each day, please enter \"1.\"",
    :pick => :one
    a_number "NUMBER PER DAY", :integer
    a_neg_1 "REFUSED"
    a_neg_2 "DON’T KNOW"

    repeater "Tell us about the cars you own" do
      dependency :rule => "A"
      condition_A :q_CIG_NOW_NUM, ">", {:integer_value => "60"}

      q "Make", :pick => :one, :display_type => :dropdown
      a "Toyota"
      a "Ford"
      a "GMChevy"
      a "Ferrari"
      a "Tesla"
      a "Honda"
      a "Other weak brand"

      q_model "Model", 
      :pick => :one
      a_1 "Small"
      a_2 "Medium"
      a_3 "Large"

      q "Year"
      dependency :rule => "A"
      condition_A :q_model, "==", :a_2
      a :string
    end


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants