From d95d59e3512f974b337888fecc39c5e87e63c440 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Tue, 26 Aug 2008 15:05:32 +0200 Subject: [PATCH] . --- statistic.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/statistic.py b/statistic.py index 101e2da..4515fe2 100644 --- a/statistic.py +++ b/statistic.py @@ -6,30 +6,28 @@ import datetime class Statistic: def IncreaseCounter(self, id, how): - return - def Timestamp(self): - return str(datetime.datetime.today().isoformat()).split(".")[0] + # + # - def __init__(self,filename="DL-A-2007.stat.xml"): - self.filename=filename + return + + def GetStatistics(self): self.stat = minidom.parse (self.filename) self.root = self.stat.documentElement self.date = self.root.getAttribute ("date") self.version = self.root.getAttribute ("version") self.name = self.root.getAttribute ("name") - id=[] - c=[] #correct - cs=[] - ws=[] - w=[] #wrong + self.statistics = [] + for q in self.root.getElementsByTagName("question"): - id.append (q.getAttribute ("id")) - c.append (q.getAttribute ("c")) - cs.append (q.getAttribute ("cs")) - ws.append (q.getAttribute ("ws")) - w.append (q.getAttribute ("w")) + id = q.getAttribute ("id") + c = q.getAttribute ("c") + cs = q.getAttribute ("cs") + ws = q.getAttribute ("ws") + w = q.getAttribute ("w") + a_code=[] a_time=[] a_when=[] @@ -39,7 +37,13 @@ class Statistic: a_code.append (a.getAttribute("answer_code")) a_time.append (a.getAttribute("needed_time")) a_when.append (a.getAttribute("datetime")) - - print id[0],c[0],cs[0],ws[0],w[0],answers + self.staticstics.append ([id, c, cs, ws, w, answers]) + + def Timestamp(self): + return str(datetime.datetime.today().isoformat()).split(".")[0] + + def __init__(self,filename="DL-A-2007.stat.xml"): + self.filename=filename + self.GetStatistics() -- 2.11.4.GIT