Content deleted Content added
per request |
add option for ranking by points per game for 2003–04 Iraqi Premier League |
||
Line 26:
-- 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 33:
-- 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
else
-- Based on points
Line 113 ⟶ 116:
elseif show_perc then
tt = p_sub.colhead(tt,36,'<abbr title="Win percentage">PCT</abbr>') -- Win percentage col
elseif show_ppg then
tt = p_sub.colhead(tt,36,'<abbr title="Points per game">PPG</abbr>') -- Points per game col
end
end
Line 159 ⟶ 164:
elseif show_perc then
tt = p_sub.colhead(tt,36,'<abbr title="Win percentage">PCT</abbr>') -- Win percentage col
elseif show_ppg then
tt = p_sub.colhead(tt,36,'<abbr title="Points per game">PPG</abbr>') -- Points per game col
end
end
Line 207 ⟶ 214:
--Some sports use draw as well
local win_perc = mm._precision_format((2*wins + draws) / (2*matches), 3)
local ppg = mm._precision_format(points / matches, 3)
if matches == 0 then
-- Escape for zero matches
win_perc = '—'
ppg = '—'
elseif losses > 0 then
-- Drop the leading zero (from the string)
win_perc = string.sub(win_perc,2,string.len(win_perc))
end
-- Show for/against
local for_against_style = Args['for_against_style'] or 'goals'
Line 299 ⟶ 308:
-- 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 309 ⟶ 318:
-- 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 = ''
Line 335 ⟶ 349:
elseif rank_perc then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..win_perc..hth_string..'\n')
elseif rank_ppg then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..ppg..hth_string..'\n')
end
end
Line 396 ⟶ 412:
elseif rank_perc then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..win_perc..hth_string..'\n')
elseif rank_ppg then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..ppg..hth_string..'\n')
end
end
|