示例#1
0
    def update(self):
        super(Phase10StatsEngine, self).update()
        self.wphases = db.queryDict(self._worst_phases)
        for row in self.wphases:
            game = row['game']
            player = row['nick']
            for r2 in self.generalplayerstats:
                if r2['nick'] == player and r2['game'] == game:
                    r2['min_phases'] = row['min_phases']
                    break

        rows = db.queryDict(self._damned_phases)
        attempts = {}
        for row in rows:
            if row['game'] not in attempts:
                attempts[row['game']] = {}
            if row['player'] not in attempts[row['game']]:
                attempts[row['game']][row['player']] = [
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
            attempts[row['game']][row['player']
                                  ][int(row['phase'])-1] = row['times']

        for row in self.generalplayerstats:
            if row['game'] in attempts:
                if row['nick'] in attempts[row['game']]:
                    times = attempts[row['game']][row['nick']]
                    max_times = max(times)
                    row['damned_phase'] = times.index(max_times) + 1
示例#2
0
 def update(self):
     super(CarcassonneStatsEngine, self).update()
     self.singleKindRecord = []
     self.matchKindRecord = []
     for kind in ("City","Road","Field"):
         self.singleKindRecord += db.queryDict(self._singleKindRecordQuery.format(kind))
         
     for kind in ("City","Road","Cloister","Field","Fair"):
         self.matchKindRecord += db.queryDict(self._matchKindRecordQuery.format(kind))
示例#3
0
    def update(self):
        super(PochaStatsEngine, self).update()
        self.hitsRecord = db.queryDict(self._hitsQuery)
        self.extremeRoundsRecord = db.queryDict(self._extremeRounds)

        for row in self.hitsRecord:
            player = row['player']
            for r2 in self.generalplayerstats:
                if r2['nick'] == player and r2['game'] == "Pocha":
                    r2['max_hits'] = row['max_hits']
                    r2['min_hits'] = row['min_hits']
                    break
        for row in self.extremeRoundsRecord:
            player = row['player']
            for r2 in self.generalplayerstats:
                if r2['nick'] == player and r2['game'] == "Pocha":
                    r2['max_round_score'] = row['max_round_score']
                    r2['min_round_score'] = row['min_round_score']
                    break
示例#4
0
 def update(self):
     # Number of matches played
     self.generalgamestats = db.queryDict(self._lastwinnerquery)
     self.generalmatchstats = db.queryDict(self._generalmatchstatsquery)
     self.generalplayerstats = db.queryDict(self._generalplayerstatsquery)
示例#5
0
FROM Match JOIN RoundStatistics USING (idMatch)
WHERE key='PhaseCompleted'
AND Game_name = 'Phase10'
ORDER BY idMatch,idRound,nick;
"""

if __name__ == "__main__":
    db = GameLogDB()
    db.connectDB("../db/gamelog.db")

    currentMatch = 0
    currentRound = 0
    aimed = {}
    result = []

    for row in db.queryDict(_mainquery):
        #        print(row)
        if int(row["idMatch"]) != currentMatch:
            currentMatch = int(row["idMatch"])
            currentRound = 0
            aimed = {}

        if int(row["idRound"]) != currentRound:
            currentRound += 1

        if currentRound == 1:
            aimed[row["nick"]] = 1

        result.append([row["idMatch"], row["idRound"], row["nick"], "PhaseAimed", aimed[row["nick"]]])
        if row["completed"] != "0":
            aimed[row["nick"]] += 1