~m4v/+junk/kmleague

« back to all changes in this revision

Viewing changes to plugin.py

  • Committer: Elián Hanisch
  • Date: 2009-09-28 01:49:37 UTC
  • Revision ID: lambdae2@gmail.com-20090928014937-3ir792yuljudpnu9
fixes for ranking table order

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
 
114
114
        def getRanking(self):
115
115
                return self.__parent.get(table=tableTable, 
116
 
                                orderBy='points DESC, frags DESC')
 
116
                                orderBy='points DESC, (frags/(frags+deaths)*100) DESC')
117
117
 
118
118
        def getMatch(self, id_match):
119
119
                return self.__parent.get(table=tableMatch, where='id_match', equal=int(id_match))
267
267
                        pos += 1
268
268
                def rankFormat(row):
269
269
                        nick = self.db.getTeam(row['id_team'])
270
 
                        return '%s. %s (%s puntos) (%s/%s)' % (bold(place[row['id_team']]),
271
 
                                        bold(nick), row['points'],
272
 
                                        mircColor(row['frags'], 'green'),
273
 
                                        mircColor(row['deaths'], 'red'))
 
270
                        frags = row['frags']
 
271
                        deaths = row['deaths']
 
272
                        eff = float(frags)/(deaths + frags)*100
 
273
                        return '%s. %s p:%s eff:%s' % (bold(place[row['id_team']]),
 
274
                                        bold(nick),
 
275
                                        mircColor(row['points'], 'green'),
 
276
                                        mircColor('%.2f%%' % eff, 'red'))
274
277
 
275
278
                if not nick:
276
279
                        max = len(ranking) > 12 and 12 or len(ranking)
277
280
                        for col in range(0, max, 3):
278
 
                                s = ' '.join(map(rankFormat, ranking[col:col+3]))
 
281
                                s = '    '.join(map(rankFormat, ranking[col:col+3]))
279
282
                                irc.reply(s)
280
283
                else:
281
284
                        if not id_team in map(lambda x: x['id_team'], ranking):