Debugging penalty/extended time score misunderstanding.

master
Ben Burlingham 9 years ago
parent 4c87e62116
commit dd20348ddc
  1. 27
      index.html
  2. 46
      js/bundle.js
  3. 32
      js/diagram.js
  4. 23
      js/matrices.js

@ -31,7 +31,7 @@
</blockquote> </blockquote>
<p> <p>
Data source: <a href="http://openfootball.github.io/">OpenFootball</a>. There are a few errors. Data source: <a href="http://openfootball.github.io/">OpenFootball</a>.
Transform and reduce scripts are built in Haskell, publically available in <a href="http://gogs.benburlingham.com/ben.burlingham/d3-worldcup">the source code</a>. Transform and reduce scripts are built in Haskell, publically available in <a href="http://gogs.benburlingham.com/ben.burlingham/d3-worldcup">the source code</a>.
</p> </p>
@ -55,12 +55,31 @@
<div class="notes"> <div class="notes">
<h5>TODO</h5> <h5>TODO</h5>
Check all ribbon hovers for strange ET/P 1930: OK
No finals in 1954 (Germany Hungary) 1934: Lots of errors?
No finals in 1962 (Chile Brazil), strange Brazil-Czech 1938:
1950:
1954: No finals (Germany Hungary)
1958:
1962: No finals (Chile Brazil), strange Brazil-Czech
Cause: teams already played eachother (uh oh) Cause: teams already played eachother (uh oh)
Solution: Add "multi" flag to something. Split diagram harder. Redraw chords within arc to have new ones. Solution: Add "multi" flag to something. Split diagram harder. Redraw chords within arc to have new ones.
1966:
1970:
1974:
1978:
1982:
1986:
1990:
1994:
1998:
2002:
2006:
2010:
2014:
update gogs
update drone
tweet it! tweet it!
</div> </div>
</body> </body>

@ -244,6 +244,25 @@
return v.tId === g.t2; return v.tId === g.t2;
}); });
var s1 = matrix[i1][i2] || 0;
var s2 = matrix[i2][i1] || 0;
if (g.sp1) {
s1 += g.sp1;
} else if (g.se1) {
s1 += g.se1;
} else {
s1 += g.s1;
}
if (g.sp2) {
s2 += g.sp2;
} else if (g.se2) {
s2 += g.se2;
} else {
s2 += g.s2;
}
matrix[i1][i2] = g.s1 + g.se1 + g.sp1; matrix[i1][i2] = g.s1 + g.se1 + g.sp1;
matrix[i2][i1] = g.s2 + g.se2 + g.sp2; matrix[i2][i1] = g.s2 + g.se2 + g.sp2;
}, []); }, []);
@ -490,13 +509,30 @@
var s1 = game.t1 === t1.tId ? game.s1 : game.s2; var s1 = game.t1 === t1.tId ? game.s1 : game.s2;
var s2 = game.t2 === t2.tId ? game.s2 : game.s1; var s2 = game.t2 === t2.tId ? game.s2 : game.s1;
var e1 = game.se1 ? '(+' + game.se1 + ' in extended time)' : ''; if (game.sp1 && game.sp2) {
var e2 = game.se2 ? '(+' + game.se2 + ' in extended time)' : ''; 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) {
s1 = game.t1 === t1.tId ? game.se1 : game.se2;
s2 = game.t2 === t2.tId ? game.se2 : game.se1;
s1 += " (Extended time)";
s2 += " (Extended time)";
}
var p1 = game.sp1 ? '(+' + game.sp1 + ' in penalties)' : ''; // const s1 = game.t1 === t1.tId ? game.s1 : game.s2;
var p2 = game.sp2 ? '(+' + game.sp2 + ' in penalties)' : ''; // const s2 = game.t2 === t2.tId ? game.s2 : game.s1;
//
// const e1 = game.se1 ? `(+${game.se1} in extended time)` : '';
// const e2 = game.se2 ? `(+${game.se2} in extended time)` : '';
//
// const p1 = game.sp1 ? `(+${game.sp1} in penalties)` : '';
// const p2 = game.sp2 ? `(+${game.sp2} in penalties)` : '';
return c1 + ': ' + s1 + ' ' + e1 + ' ' + p1 + '\n' + c2 + ': ' + s2 + ' ' + e2 + ' ' + p2 + '\n' + data.rounds[game.rId]; return c1 + ': ' + s1 + '\n' + c2 + ': ' + s2 + '\n' + data.rounds[game.rId];
}); });
group.append("text").each(function (d) { group.append("text").each(function (d) {

@ -223,16 +223,34 @@ const Diagram = {
return (v.t1 === t1.tId || v.t1 === t2.tId) && (v.t2 === t1.tId || v.t2 === t2.tId); return (v.t1 === t1.tId || v.t1 === t2.tId) && (v.t2 === t1.tId || v.t2 === t2.tId);
}); });
const s1 = game.t1 === t1.tId ? game.s1 : game.s2; let s1 = game.t1 === t1.tId ? game.s1 : game.s2;
const s2 = game.t2 === t2.tId ? game.s2 : game.s1; let s2 = game.t2 === t2.tId ? game.s2 : game.s1;
const e1 = game.se1 ? `(+${game.se1} in extended time)` : ''; if (game.sp1 && game.sp2) {
const e2 = game.se2 ? `(+${game.se2} in extended time)` : ''; s1 = game.t1 === t1.tId ? game.sp1 : game.sp2;
s2 = game.t2 === t2.tId ? game.sp2 : game.sp1;
const p1 = game.sp1 ? `(+${game.sp1} in penalties)` : ''; s1 += " (Penalties)";
const p2 = game.sp2 ? `(+${game.sp2} in penalties)` : ''; s2 += " (Penalties)";
}
else if (game.se1 && game.se2) {
s1 = game.t1 === t1.tId ? game.se1 : game.se2;
s2 = game.t2 === t2.tId ? game.se2 : game.se1;
s1 += " (Extended time)";
s2 += " (Extended time)";
}
// const s1 = game.t1 === t1.tId ? game.s1 : game.s2;
// const s2 = game.t2 === t2.tId ? game.s2 : game.s1;
//
// const e1 = game.se1 ? `(+${game.se1} in extended time)` : '';
// const e2 = game.se2 ? `(+${game.se2} in extended time)` : '';
//
// const p1 = game.sp1 ? `(+${game.sp1} in penalties)` : '';
// const p2 = game.sp2 ? `(+${game.sp2} in penalties)` : '';
return `${c1}: ${s1} ${e1} ${p1}\n${c2}: ${s2} ${e2} ${p2}\n${data.rounds[game.rId]}`; return `${c1}: ${s1}\n${c2}: ${s2}\n${data.rounds[game.rId]}`;
}); });
group.append("text") group.append("text")

@ -14,6 +14,29 @@ const Matrices = {
const i1 = teams.findIndex(v => v.tId === g.t1); const i1 = teams.findIndex(v => v.tId === g.t1);
const i2 = teams.findIndex(v => v.tId === g.t2); const i2 = teams.findIndex(v => v.tId === g.t2);
let s1 = matrix[i1][i2] || 0;
let s2 = matrix[i2][i1] || 0;
if (g.sp1) {
s1 += g.sp1;
}
else if (g.se1) {
s1 += g.se1;
}
else {
s1 += g.s1;
}
if (g.sp2) {
s2 += g.sp2;
}
else if (g.se2) {
s2 += g.se2;
}
else {
s2 += g.s2;
}
matrix[i1][i2] = g.s1 + g.se1 + g.sp1; matrix[i1][i2] = g.s1 + g.se1 + g.sp1;
matrix[i2][i1] = g.s2 + g.se2 + g.sp2; matrix[i2][i1] = g.s2 + g.se2 + g.sp2;
}, []); }, []);

Loading…
Cancel
Save