예제 #1
0
파일: grader.py 프로젝트: reedboat/vimfound
    def calc(self, id=0, data=None):
        table = PluginTable()
        table.connect()
        id = int(id)
        avg = self.calcAvg()

        if id > 0:
            data  = table.findById(id)
        if data:
            score = self.gradePlugin(data, avg)
            table.updateScore(id, score)
            return score

        rows=table.query(None, None, 0)
        for row in rows:
            score = self.gradePlugin(row, avg)
            table.updateScore(row['id'], score)
        return len(rows)