1

I am trying to setup a question in surveyor (http://github.com/NUBIC/surveyor/) that has a dropdown box with values 1 to 50. The next question should only be visible if the the user chooses 1 in the first question. Here is my code to do this:

survey "Test survey dependency", :default_mandatory => true do
  section "questions" do
    q_1 "Click on 1 to see the next question", :pick => :one, :display_type => :dropdown
    ((1..49).to_a + ["50 or more"]).each{|num| a num.to_s, reference_identifier: num.to_s}

    q "Hello?"
    a "Hello"
    dependency :rule => "A"
    condition_A :q_1, "==", {:answer_reference => "1"}
  end
end

Now, this should compare :q_1 with :a_0. However this is the error I get:

rake surveyor FILE=surveys/survey.rb
rake aborted!
Bad references: q_1, a_0
/home/ari/.rvm/gems/ruby-1.9.3-p392/gems/surveyor-1.3.0/lib/surveyor/parser.rb:59:in `instance_eval'
/home/ari/.rvm/gems/ruby-1.9.3-p392/gems/surveyor-1.3.0/lib/surveyor/parser.rb:120:in `report_lost_and_duplicate_references'
/home/ari/.rvm/gems/ruby-1.9.3-p392/gems/surveyor-1.3.0/lib/surveyor/parser.rb:84:in `method_missing'
(eval):1:in `parse'

If I change condition_A to condition_A :q_1, "==", {:string_value => "1"}, it gets parsed successfully but the next question is still never shown.

Everything in the example, kitchen_sink_survey.rb works fine.

So it looks like setting :reference_identifier manually doesn't do anything. Is this a bug or by design? And can I do anything about it apart from test for the actual value?

4

1 回答 1

0

这实际上是surveyor中的一个错误,但现在已在github上修复:https ://github.com/NUBIC/surveyor/commit/a9b68f668da936fbe16fc89448e53c463b867dc0

于 2013-04-05T22:43:12.173 回答