1 import questions
, statistic
6 if self
.method
== "BadQuestions":
8 qid
= self
.FindBadQuestion()
9 elif self
.method
== "GoodQuestions":
11 qid
= self
.FindGoodQuestion()
12 elif self
.method
== "NewQuestions":
14 qid
= self
.FindNewQuestion()
16 qid
= self
.FindAnyQuestion()
18 self
.q
.AskQuestion (qid
)
20 self
.question
= self
.q
.question
21 self
.answera
= self
.q
.answera
22 self
.answerb
= self
.q
.answerb
23 self
.answerc
= self
.q
.answerc
24 self
.answerd
= self
.q
.answerd
25 self
.answercorrect
= self
.q
.answercorrect
26 self
.hint
= self
.q
.hint
27 self
.correct
, self
.wrong
= self
.s
.ThisQuestion (self
.id)
29 def EvalQuestion(self
, answer
):
30 if self
.q
.correct
== answer
:
35 self
.s
.IncreaseCounter (self
.id, c
, self
.q
.RealAnswer(answer
))
39 def FindAnyQuestion(self
):
40 nq
= int (r
.random()*self
.q
.nquestions
)
41 return self
.q
.questions
[nq
][0]
43 def FindNewQuestion(self
):
44 nq
= r
.randint(0,self
.s
.nnewquestion
)
45 return self
.s
.newquestion
[nq
]
47 def FindBadQuestion(self
):
48 nq
= r
.randint(0,self
.s
.nbadquestion
)
49 return self
.s
.badquestion
[nq
]
51 def FindGoodQuestion(self
):
52 nq
= r
.randint(0,self
.s
.ngoodquestion
)
53 return self
.s
.goodquestion
[nq
]
58 def __init__(self
,method
="",catalog
="TechnikA"):
59 if catalog
== "TechnikA":
60 quest
= "TechnikA/www.oliver-saal.de/software/afutrainer/download/questions.xml"
61 stat
= "TechnikA/DL-A-2007.stat.xml"
62 elif catalog
== "TechnikE":
63 quest
= "TechnikE/www.oliver-saal.de/software/afutrainer/download/questions.xml"
64 stat
= "TechnikE/DL-E-2007.stat.xml"
65 elif catalog
== "BetriebAE":
66 quest
= "TechnikA/www.oliver-saal.de/software/afutrainer/download/questions.xml"
67 stat
= "BetriesAE/FIXMEtat.xml" #FIXME
69 self
.q
= questions
.Questions(filename
=quest
)
70 self
.s
= statistic
.Statistic(filename
=stat
)