]> git.sesse.net Git - remoteglot-book/commitdiff
Fix totals line.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:16:46 +0000 (00:16 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 13 Dec 2014 23:16:46 +0000 (00:16 +0100)
www/js/book.js

index a489a6a3ed3c1a1dc0ef199789b870274ee42032..8f0c24164d4434142ff0cd1ddd958520f2aebab6 100644 (file)
@@ -97,9 +97,11 @@ var show_lines = function(data, game) {
        var total_num = 0;
        for (var i = 0; i < moves.length; ++i) {
                var move = moves[i];
-               total_num += parseInt(move['white']);
-               total_num += parseInt(move['draw']);
-               total_num += parseInt(move['black']);
+               if (move['move']) {
+                       total_num += parseInt(move['white']);
+                       total_num += parseInt(move['draw']);
+                       total_num += parseInt(move['black']);
+               }
        }
 
        var headings_tr = $("#headings");
@@ -177,7 +179,7 @@ var show_lines = function(data, game) {
                var line = lines[i];
                var tr = document.createElement("tr");
 
-               if (line[0] === undefined || line[0] === null) {
+               if (line[0] === undefined) {
                        $(tr).addClass("totals");
                }