18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/asker/formatter/question_moodlexml_formatter.rb', line 18
def self.choice_to_s(question)
s = []
penalties = ['', '%-50%', '%-33.33333%', '%-25%', '%-20%']
penalty = penalties[question.bads.size]
s << "<!-- question: #{question.name} -->"
s << '<question type="multichoice">'
s << ' <name>'
s << " <text>#{question.name}</text>"
s << ' </name>'
s << ' <questiontext format="html">'
s << " <text><![CDATA[#{question.text}]]></text>"
s << ' </questiontext>'
s << ' <generalfeedback format="html">'
s << " <text>#{question.feedback}</text>"
s << ' </generalfeedback>'
s << ' <defaultgrade>1.0000000</defaultgrade>'
s << " <penalty>#{penalty}</penalty>"
s << ' <hidden>0</hidden>'
s << ' <single>true</single>'
s << " <shuffleanswers>#{question.shuffle?}</shuffleanswers>"
s << ' <answernumbering>abc</answernumbering>'
s << ' <incorrectfeedback format="html">'
s << " <text>#{question.feedback}</text>"
s << ' </incorrectfeedback>'
s << ' <answer fraction="100" format="html">'
s << " <text>#{question.good}</text>"
s << ' </answer>'
s << ' <answer fraction="-25" format="html">'
s << " <text>#{question.bad[0]}</text>"
s << ' </answer>'
s << ' </question>'
s << ' <answer fraction="-25" format="html">'
s << " <text>#{question.bad[1]}</text>"
s << ' </answer>'
s << ' </question>'
s << ' <answer fraction="-25" format="html">'
s << " <text>#{question.bad[2]}</text>"
s << ' </answer>'
s << ' </question>'
s
end
|