]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Fix bug in player badges: win% color computed wrong
authorJan Behrens <zykure@web.de>
Tue, 23 Apr 2013 07:40:37 +0000 (09:40 +0200)
committerJan Behrens <zykure@web.de>
Tue, 23 Apr 2013 07:40:37 +0000 (09:40 +0200)
xonstat/batch/badges/skin.py

index 982512edb83c9653c48a8d7355c594b5ee61691d..f18370f9d79546d9e1212cb840323191f457fff7 100644 (file)
@@ -413,16 +413,16 @@ class Skin:
         try:
             txt = "%.2f%%" % round(win_pct, 2)
         except:
-            win_pct = 0
+            win_pct = 0.
 
         if self.winp_pos:
-            if win_pct >= 0.5:
-                nr = 2*(win_pct-0.5)
+            if win_pct >= 50.0:
+                nr = 2*(win_pct/100-0.5)
                 r = nr*self.winp_colortop[0] + (1-nr)*self.winp_colormid[0]
                 g = nr*self.winp_colortop[1] + (1-nr)*self.winp_colormid[1]
                 b = nr*self.winp_colortop[2] + (1-nr)*self.winp_colormid[2]
             else:
-                nr = 2*win_pct
+                nr = 2*(win_pct/100)
                 r = nr*self.winp_colormid[0] + (1-nr)*self.winp_colorbot[0]
                 g = nr*self.winp_colormid[1] + (1-nr)*self.winp_colorbot[1]
                 b = nr*self.winp_colormid[2] + (1-nr)*self.winp_colorbot[2]