]> git.sesse.net Git - remoteglot-book/commitdiff
Fix win percentage display after last patch.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Dec 2014 23:12:31 +0000 (00:12 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 15 Dec 2014 23:12:31 +0000 (00:12 +0100)
www/js/book.js

index 599805832b694da7779bf161091f77c49cd4ab66..a100fc85afc1e48fd9953a16b4936bc23e23a9d7 100644 (file)
@@ -170,7 +170,7 @@ var show_lines = function(data, game) {
 
                // Win%.
                var white_win_ratio = (white + 0.5 * draw) / num;
-               var win_ratio = (i % 2 == 0) ? white_win_ratio : 1.0 - white_win_ratio;
+               var win_ratio = (move_override % 2 == 0) ? white_win_ratio : 1.0 - white_win_ratio;
                line.push(win_ratio);
 
                line.push(white);        // WWin.
@@ -190,7 +190,7 @@ var show_lines = function(data, game) {
                        var win_elo = -400.0 * Math.log(1.0 / white_win_ratio - 1.0) / Math.LN10;
                        win_elo -= (move['white_avg_elo'] - move['black_avg_elo']);
                        white_win_ratio = 1.0 / (1.0 + Math.pow(10, win_elo / -400.0));
-                       win_ratio = (i % 2 == 0) ? white_win_ratio : 1.0 - white_win_ratio;
+                       win_ratio = (move_override % 2 == 0) ? white_win_ratio : 1.0 - white_win_ratio;
                        line.push(win_ratio);
                } else {
                        line.push(null);