From 27cac531130b803ec27b2df86d6c9a716d3c9abf Mon Sep 17 00:00:00 2001 From: Ben Burlingham Date: Sun, 20 Nov 2016 07:07:50 -0800 Subject: [PATCH] Debugging falsy matching. --- index.html | 48 +++++++++++++++++++++---- js/bundle.js | 98 +++++++++++++++++++++++++++++++++++++++++++++----- js/diagram.js | 4 +-- js/index.js | 8 +++-- js/matrices.js | 8 ++--- 5 files changed, 143 insertions(+), 23 deletions(-) diff --git a/index.html b/index.html index ebc7d3d..3244155 100644 --- a/index.html +++ b/index.html @@ -56,14 +56,24 @@
TODO
1930: OK - 1934: Lots of errors? + 1934: Patched. + Italy Spain replay 1-0! 1938: - 1950: - 1954: No finals (Germany Hungary) + Switzerland Germany replay 4-2 + Cuba Romania replay 3-2 + Brazil Czech replay 2-1 + 1950: OK + 1954: + Germany Turkey playoff 7-2 + Switzerland Italy playoff 4-1 + Germany Hungary final 3-2 1958: - 1962: No finals (Chile Brazil), strange Brazil-Czech - Cause: teams already played eachother (uh oh) - Solution: Add "multi" flag to something. Split diagram harder. Redraw chords within arc to have new ones. + Northern Ireland Czech playoff 2-1 + Wales Hungary replay 2-1 + Sweden Wales 0-0 + Brazil England 0-0 + Russia England replay 1-0 + 1962: 1966: 1970: 1974: @@ -74,10 +84,36 @@ 1994: 1998: 2002: + France Uruguay 0-0 + Nigeria England 0-0 + Brazil Turkey replay 1-0 2006: + Trinidad Tobago Sweden 0-0 + Netherlands Argentina 0-0 + Mexico Angola 0-0 + Japan Croatia 0-0 + France Switzerland 0-0 2010: + Uruguay France 0-0 + England Algeria 0-0 + Paraguay New Zealand 0-0 + Ivory Coast Portugal 0-0 + Portugal Brazil 0-0 + Switzerland Honduras 0-0 2014: + Brazil Mexico 0-0 + Japan Greece 0-0 + Costa Rica England 0-0 + Ecuador France 0-0 + Iran-Nigeria 0-0 + Brazil Chile replay + Costa Rica Greece replay + Netherlands Costa Rica replay + Argentina Netherlands replay + gremlins? + + african dictator visualization update gogs update drone tweet it! diff --git a/js/bundle.js b/js/bundle.js index f295d3b..4d11526 100644 --- a/js/bundle.js +++ b/js/bundle.js @@ -58,9 +58,9 @@ var _ui2 = _interopRequireDefault(_ui); - var _sorter = __webpack_require__(3); + var _hotfixes = __webpack_require__(13); - var _sorter2 = _interopRequireDefault(_sorter); + var _hotfixes2 = _interopRequireDefault(_hotfixes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -166,6 +166,10 @@ main.json = JSON.parse(strData); }, + patchErrors: function patchErrors() { + main.json.tourneys['1934'] = _hotfixes2.default.patch1934(main.json.tourneys['1934']); + }, + getState: function getState() { var params = window.location.href.split('?')[1]; @@ -209,7 +213,7 @@ } }; - main.fetch('worldcup.json').then(main.initJSON).then(main.initState).then(main.generateUI).then(main.updateUI); + main.fetch('worldcup.json').then(main.initJSON).then(main.patchErrors).then(main.initState).then(main.generateUI).then(main.updateUI); /***/ }, /* 1 */ @@ -247,17 +251,17 @@ var s1 = matrix[i1][i2] || 0; var s2 = matrix[i2][i1] || 0; - if (g.sp1) { + if (g.sp1 !== null) { s1 += g.sp1; - } else if (g.se1) { + } else if (g.se1 !== null) { s1 += g.se1; } else { s1 += g.s1; } - if (g.sp2) { + if (g.sp2 !== null) { s2 += g.sp2; - } else if (g.se2) { + } else if (g.se2 !== null) { s2 += g.se2; } else { s2 += g.s2; @@ -509,13 +513,13 @@ var s1 = game.t1 === t1.tId ? game.s1 : game.s2; var s2 = game.t2 === t2.tId ? game.s2 : game.s1; - if (game.sp1 && game.sp2) { + if (game.sp1 !== null && game.sp2 !== null) { s1 = game.t1 === t1.tId ? game.sp1 : game.sp2; s2 = game.t2 === t2.tId ? game.sp2 : game.sp1; s1 += " (Penalties)"; s2 += " (Penalties)"; - } else if (game.se1 && game.se2) { + } else if (game.se1 !== null && game.se2 !== null) { s1 = game.t1 === t1.tId ? game.se1 : game.se2; s2 = game.t2 === t2.tId ? game.se2 : game.se1; @@ -1042,5 +1046,81 @@ // removed by extract-text-webpack-plugin +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var hotfixes = { + patch1934: function patch1934(data) { + data.games.forEach(function (g) { + if (g.t1 === 149 && g.t2 === 2 && g.rId === 13) { + g.s1 = 4; + g.s2 = 2; + } + if (g.t1 === 223 && g.t2 === 146 && g.rId === 13) { + g.s1 = 2; + g.s2 = 1; + } + if (g.t1 === 134 && g.t2 === 223 && g.rId === 18) { + g.s1 = 2; + g.s2 = 1; + } + if (g.t1 === 223 && g.t2 === 153 && g.rId === 14) { + g.s1 = 3; + g.s2 = 2; + } + if (g.t1 === 223 && g.t2 === 127 && g.rId === 16) { + g.s1 = 3; + g.s2 = 1; + } + if (g.t1 === 134 && g.t2 === 129 && g.rId === 14) { + g.s1 = 1; + g.s2 = 1; + } + if (g.t1 === 134 && g.t2 === 191 && g.rId === 13) { + g.s1 = 7; + g.s2 = 1; + } + if (g.t1 === 153 && g.t2 === 137 && g.rId === 13) { + g.s1 = 3; + g.s2 = 2; + } + if (g.t1 === 129 && g.t2 === 211 && g.rId === 13) { + g.s1 = 3; + g.s2 = 1; + } + if (g.t1 === 127 && g.t2 === 125 && g.rId === 13) { + g.s1 = 5; + g.s2 = 2; + } + if (g.t1 === 124 && g.t2 === 131 && g.rId === 13) { + g.s1 = 3; + g.s2 = 2; + } + if (g.t1 === 147 && g.t2 === 210 && g.rId === 13) { + g.s1 = 3; + g.s2 = 2; + } + if (g.t1 === 127 && g.t2 === 124 && g.rId === 17) { + g.s1 = 3; + g.s2 = 2; + } + if (g.t1 === 124 && g.t2 === 149 && g.rId === 14) { + g.s1 = 2; + g.s2 = 1; + } + }); + + return data; + } + }; + + exports.default = hotfixes; + /***/ } /******/ ]); \ No newline at end of file diff --git a/js/diagram.js b/js/diagram.js index d5985cc..2e73963 100644 --- a/js/diagram.js +++ b/js/diagram.js @@ -226,14 +226,14 @@ const Diagram = { let s1 = game.t1 === t1.tId ? game.s1 : game.s2; let s2 = game.t2 === t2.tId ? game.s2 : game.s1; - if (game.sp1 && game.sp2) { + if (game.sp1 !== null && game.sp2 !== null) { s1 = game.t1 === t1.tId ? game.sp1 : game.sp2; s2 = game.t2 === t2.tId ? game.sp2 : game.sp1; s1 += " (Penalties)"; s2 += " (Penalties)"; } - else if (game.se1 && game.se2) { + else if (game.se1 !== null && game.se2 !== null) { s1 = game.t1 === t1.tId ? game.se1 : game.se2; s2 = game.t2 === t2.tId ? game.se2 : game.se1; diff --git a/js/index.js b/js/index.js index 472f84f..7c547d5 100644 --- a/js/index.js +++ b/js/index.js @@ -1,7 +1,7 @@ import Matrices from './matrices'; import Diagram from './diagram'; import UI from './ui'; -import Sorter from './sorter' +import Hotfixes from './hotfixes'; require('../css/reset.scss'); require('../css/index.scss'); @@ -101,6 +101,10 @@ const main = { main.json = JSON.parse(strData); }, + patchErrors: () => { + main.json.tourneys['1934'] = Hotfixes.patch1934(main.json.tourneys['1934']); + }, + getState: () => { const params = window.location.href.split('?')[1]; @@ -123,7 +127,6 @@ const main = { state.scheme = state.scheme || Math.ceil(Math.random() * 4); state.rounds = state.rounds || Object.values(UI.ROUND_TYPES); - main.setState(state); }, @@ -147,6 +150,7 @@ const main = { main.fetch('worldcup.json') .then(main.initJSON) + .then(main.patchErrors) .then(main.initState) .then(main.generateUI) .then(main.updateUI); diff --git a/js/matrices.js b/js/matrices.js index 80696e8..e1c262e 100644 --- a/js/matrices.js +++ b/js/matrices.js @@ -17,20 +17,20 @@ const Matrices = { let s1 = matrix[i1][i2] || 0; let s2 = matrix[i2][i1] || 0; - if (g.sp1) { + if (g.sp1 !== null) { s1 += g.sp1; } - else if (g.se1) { + else if (g.se1 !== null) { s1 += g.se1; } else { s1 += g.s1; } - if (g.sp2) { + if (g.sp2 !== null) { s2 += g.sp2; } - else if (g.se2) { + else if (g.se2 !== null) { s2 += g.se2; } else {