From 1c056ce094831a0e5881643f57b8c5d76ccf554b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 11 May 2023 17:43:17 +0200 Subject: [PATCH] Count touches per-point. --- ultimate.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ultimate.js b/ultimate.js index d030ec4..af051b2 100644 --- a/ultimate.js +++ b/ultimate.js @@ -605,6 +605,7 @@ function make_table_per_point(players) { add_cell(header, 'th', 'Ds'); add_cell(header, 'th', 'Throwaways'); add_cell(header, 'th', 'Drops'); + add_cell(header, 'th', 'Touches'); rows.push(header); } @@ -614,6 +615,7 @@ function make_table_per_point(players) { let defenses = 0; let throwaways = 0; let drops = 0; + let touches = 0; for (const [q,p] of Object.entries(players)) { if (q === 'globals') continue; let row = document.createElement('tr'); @@ -625,6 +627,7 @@ function make_table_per_point(players) { add_cell(row, 'td', p.defenses == 0 ? 0 : (p.defenses / p.points_played).toFixed(2)); add_cell(row, 'td', p.throwaways == 0 ? 0 : (p.throwaways / p.points_played).toFixed(2)); add_cell(row, 'td', p.drops == 0 ? 0 : (p.drops / p.points_played).toFixed(2)); + add_cell(row, 'td', p.touches == 0 ? 0 : (p.touches / p.points_played).toFixed(2)); } else { add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); @@ -632,6 +635,7 @@ function make_table_per_point(players) { add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); + add_cell(row, 'td', 'N/A'); } rows.push(row); @@ -641,6 +645,7 @@ function make_table_per_point(players) { defenses += p.defenses; throwaways += p.throwaways; drops += p.drops; + touches += p.touches; } // Globals. @@ -654,6 +659,7 @@ function make_table_per_point(players) { add_cell(row, 'td', defenses == 0 ? 0 : (defenses / globals.points_played).toFixed(2)); add_cell(row, 'td', throwaways == 0 ? 0 : (throwaways / globals.points_played).toFixed(2)); add_cell(row, 'td', drops == 0 ? 0 : (drops / globals.points_played).toFixed(2)); + add_cell(row, 'td', touches == 0 ? 0 : (touches / globals.points_played).toFixed(2)); } else { add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); @@ -661,6 +667,7 @@ function make_table_per_point(players) { add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); add_cell(row, 'td', 'N/A'); + add_cell(row, 'td', 'N/A'); } rows.push(row); -- 2.39.2