Content deleted Content added
optional digitpad for 1993 Football League First Division play-off Final, should do nothing if not specified |
option for Template:WDL style win percentage |
||
Line 28:
local loss_first = Args['loss_before_draw'] or Args['loss_before_tie'] or false
-- What to rank the teams by
local ranking_style = string.lower(Args['ranking_style'] or 'pts')
local show_points, show_wperc, show_perc, show_ppg = false, 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
-- Based on wins
elseif ranking_style=='wperc' or ranking_style=='win percentage' or ranking_style=='%w' then
show_wperc = true
elseif ranking_style=='perc' or ranking_style=='percentage' or ranking_style=='%' then
-- Based on percentage
Line 192 ⟶ 193:
if show_perc then
tt = p_sub.colhead(tt,36,'<abbr title="Win percentage">PCT</abbr>') -- Win percentage col
elseif show_wperc then
tt = p_sub.colhead(tt,36,'<abbr title="Win percentage">WPCT</abbr>') -- Win percentage col
end
if show_ppg then
Line 260 ⟶ 263:
local s_pts = (tonumber(Args['adjust_points_'..team_code_ii]) or 0) + (tonumber(Args['startpoints_'..team_code_ii]) or 0)
local hth_local = yesno(Args['show_hth'] or 'yes') and Args['hth_'..team_code_ii] or nil
▲ local ranking_style = string.lower(Args['ranking_style'] or 'pts')
-- Then calculate some values
local matches = wins + draws + losses
Line 277 ⟶ 281:
local win_perc = mm._precision_format((2*wins + draws) / (2*matches), 3)
local ppg = mm._precision_format(points / matches, 2)
if ranking_style=='wperc' or ranking_style=='win percentage' or ranking_style=='%w' then
win_perc = mm._precision_format(100 * wins / matches, 1)
end
if matches == 0 then
-- Escape for zero matches
Line 376 ⟶ 383:
-- What to rank the teams by
local rank_points, rank_perc, rank_ppg = false, false, false
local win_fw, win_string
if ranking_style=='w' or ranking_style=='win' or ranking_style=='wins' then
-- Based on wins
Line 385 ⟶ 391:
win_string = hth_string
elseif ranking_style=='perc' or ranking_style=='percentage' or ranking_style=='%' then
-- Based on percentage
rank_perc = true
win_fw=ii_fw
win_string = ''
elseif ranking_style=='wperc' or ranking_style=='win percentage' or ranking_style=='%w' then
-- Based on percentage
rank_perc = true
|