]> git.sesse.net Git - pkanalytics/commitdiff
Count touches per-point.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 May 2023 15:43:17 +0000 (17:43 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 11 May 2023 15:43:17 +0000 (17:43 +0200)
ultimate.js

index d030ec43c9bd6928c7b6a37f18f0630c2e1a3acc..af051b27b8f7966c050fcee8f3671febb857b3d6 100644 (file)
@@ -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);