From 609c3c7bd861b8a4709eba7dd2a736708d55c409 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Wed, 3 Sep 2008 08:01:50 +0200 Subject: [PATCH] . --- framework.py | 12 ++++++++---- statistic.py | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/framework.py b/framework.py index 27d0c98..89cd031 100644 --- a/framework.py +++ b/framework.py @@ -10,17 +10,17 @@ class Framework: if self.loud: print "Bad question" qid = self.FindBadQuestion() - self.q.badquestion.pop (self.q.badquestion.index (qid)) + self.s.badquestion.pop (self.s.badquestion.index (qid)) elif self.method == "GoodQuestions": if self.loud: print "Good questions" qid = self.FindGoodQuestion() - self.q.goodquestion.pop (self.q.goodquestion.index (qid)) + self.s.goodquestion.pop (self.s.goodquestion.index (qid)) elif self.method == "NewQuestions": if self.loud: print "New question" qid = self.FindNewQuestion() - self.q.newquestion.pop (self.q.newquestion.index (qid)) + self.s.newquestion.pop (self.s.newquestion.index (qid)) else: qid = self.FindAnyQuestion() @@ -53,7 +53,11 @@ class Framework: self.time1 = time.time() dt = self.time1-self.time0 - self.s.IncreaseCounter (self.id, c, self.q.RealAnswer(answer), dt) + tt = self.s.IncreaseCounter (self.id, c, self.q.RealAnswer(answer), dt) + if tt == True: + self.s.goodquestion.append(self.id) + else: + self.s.badquestion.append(self.id) return c diff --git a/statistic.py b/statistic.py index 74507ad..74b275a 100644 --- a/statistic.py +++ b/statistic.py @@ -14,6 +14,9 @@ def toprettyxml_fixed (node): #, encoding='utf-8'): class Statistic: def IncreaseCounter(self, qid, how, answer, time): + """ + Return True, is question is good + """ nq = self.FindQuestion (qid) if nq >= 0: for q in self.root.getElementsByTagName("question"): @@ -79,10 +82,7 @@ class Statistic: else: rr = float(cs)*norm - if rr >= self.ratio: - self.goodquestion.append (qid) - elif rr >= 0: - self.badquestion.append (qid) + return rr >= self.ratio def WriteFile(self): print "Writing statistics file",self.filename -- 2.11.4.GIT