Class: Senkyoshi::OpinionScale

Inherits:
Question show all
Defined in:
lib/senkyoshi/models/questions/opinion_scale.rb

Constant Summary

Constants inherited from Question

Question::ITEM_FUNCTION, Question::QUESTION_TYPE

Instance Attribute Summary

Attributes inherited from Question

#answers

Instance Method Summary collapse

Methods inherited from Question

#canvas_conversion, from, #get_fraction, #initialize, #iterate_item, #set_answers, #set_correct_answers, #set_feedback, #set_incorrect_answers, #set_material, #set_max_score

Methods inherited from Resource

#_search_and_replace, #cleanup, #fix_html, #matches_xid?

Constructor Details

This class inherits a constructor from Senkyoshi::Question

Instance Method Details

#iterate_xml(data) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/senkyoshi/models/questions/opinion_scale.rb', line 5

def iterate_xml(data)
  super
  if response_block = data.at("flow[@class=RESPONSE_BLOCK]")
    set_answers(data.at("resprocessing"))
    response_block.at("render_choice").children.each do |choice|
      id = choice.at("response_label").attributes["ident"].value
      @answer_text = choice.at("mat_formattedtext").text
      answer = Answer.new(@answer_text, id)
      answer.fraction = get_fraction(id)
      @answers.push(answer)
    end
  end
  self
end