From: Steinar H. Gunderson Date: Thu, 11 May 2023 15:30:05 +0000 (+0200) Subject: Fix some N/A displays in the viewer. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=73594a910182176d2810c2fb1d2033abc6402456;p=pkanalytics Fix some N/A displays in the viewer. --- diff --git a/ultimate.js b/ultimate.js index 7fbfa17..10f8fac 100644 --- a/ultimate.js +++ b/ultimate.js @@ -455,10 +455,18 @@ function make_table_offense(players) { add_cell(row, 'td', p.hockey_assists); add_cell(row, 'td', p.num_throws); add_cell(row, 'td', p.throwaways); - add_cell(row, 'td', throw_ok.toFixed(0) + '%'); + if (p.num_throws > 0) { + add_cell(row, 'td', throw_ok.toFixed(0) + '%'); + } else { + add_cell(row, 'td', 'N/A'); + } add_cell(row, 'td', p.catches); add_cell(row, 'td', p.drops); - add_cell(row, 'td', catch_ok.toFixed(0) + '%'); + if (p.catches + p.drops > 0) { + add_cell(row, 'td', catch_ok.toFixed(0) + '%'); + } else { + add_cell(row, 'td', 'N/A'); + } add_cell(row, 'td', '+' + p.offensive_soft_plus); add_cell(row, 'td', '-' + p.offensive_soft_minus); rows.push(row);