Content deleted Content added
fix div by zero |
adding optional ppg |
||
Line 30:
-- What to rank the teams by
local ranking_style = Args['ranking_style'] or 'pts'
local show_points, show_perc, show_ppg = false, false, false
ranking_style = string.lower(ranking_style)
if ranking_style=='w' or ranking_style=='win' or ranking_style=='wins' or ranking_style=='none' then
Line 37:
-- Based on percentage
show_perc = true
elseif ranking_style=='ppg' or ranking_style=='points per game' or ranking_style=='ptspergame' then
-- Based on points per game
show_ppg = true
elseif ranking_style=='percpts' or ranking_style=='%pts' then
-- Based on percentage and points
show_perc = true
show_points = true
elseif ranking_style=='ppgpts' then
-- Based on ppg and points
show_ppg = true
show_points = true
else
-- Based on points
Line 129 ⟶ 140:
if show_points then
tt = p_sub.colhead(tt,32,'<abbr title="Points">Pts</abbr>') -- Points col
end
tt = p_sub.colhead(tt,36,'<abbr title="Point percentage">PCT</abbr>') -- Point percentage col
end
if show_ppg then
tt = p_sub.colhead(tt,36,'<abbr title="Points per game">PPG</abbr>') -- Points per game col
end
if full_table then
Line 182 ⟶ 197:
matches = tonumber(Args['matches_'..team_code_ii]) or matches
end
local percentage_format = Args['percentage_format']
local point_perc = ''
local ppg = ''
if tonumber(matches) == nil or (matches*win_points) == 0 then
-- Escape for zero matches
point_perc = '—'
ppg = '—'
else
if percentage_format == 'hundred 1 decimal' then
Line 201 ⟶ 218:
point_perc = string.sub(point_perc,2,string.len(point_perc))
end
ppg = mm._precision_format(points / matches, 2)
end
Line 288 ⟶ 306:
-- What to rank the teams by
local ranking_style = Args['ranking_style'] or 'pts'
local rank_points, rank_perc, rank_ppg = false, false, false
local win_fw, win_string
ranking_style = string.lower(ranking_style)
Line 298 ⟶ 316:
-- Based on percentage
rank_perc = true
win_fw=ii_fw
win_string = ''
elseif ranking_style=='ppg' or ranking_style=='points per game' or ranking_style=='ptspergame' then
-- Based on points per game
rank_ppg = true
win_fw=ii_fw
win_string = ''
elseif ranking_style=='percpts' or ranking_style=='%pts' then
-- Based on percentage and points
rank_perc = true
rank_points = true
win_fw=ii_fw
win_string = ''
elseif ranking_style=='ppgpts' then
-- Based on ppg and points
rank_ppg = true
rank_points = true
win_fw=ii_fw
win_string = ''
Line 379 ⟶ 414:
elseif rank_perc then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..point_perc..hth_string..'\n')
end
if rank_ppg then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..ppg..hth_string..'\n')
end
if show_GB then
|