Module:Sports table/WDL OT: Difference between revisions

Content deleted Content added
default headings when shootout used
fix
 
(9 intermediate revisions by 3 users not shown)
Line 9:
-- Pre stuff
local team_width = Args['teamwidth'] or '190'
local score_width = Args['scorewidth'] or '32'
local sort_text = yesno(Args['sortable_table'] or 'no') and ' sortable' or ''
local show_played = not yesno(Args['hide_played'] or 'no')
Line 49 ⟶ 50:
-- Based on ppg and points
show_ppg = true
show_points = true
elseif ranking_style=='forpts' then
-- Based on goals for and points
show_points = true
else
Line 58 ⟶ 62:
local for_against_style = Args['for_against_style'] or 'goals'
local fa_letter, fa_word_sing, fa_word_plur
local hide_for_against = false
-- First convert to lower case if it is a string
for_against_style = string.lower(for_against_style)
Line 68 ⟶ 73:
fa_word_sing = 'Point'
fa_word_plur = 'Points'
elseif for_against_style=='none' then
hide_for_against = true
else
fa_letter = 'G'
Line 102 ⟶ 109:
-- Actual headers
if pos_label ~= nil then
tt = p_sub.colhead(tt,32score_width,pos_label) -- Position col
end
-- Add group header
Line 110 ⟶ 117:
tt = p_sub.colhead(tt,team_width,'Team'..VTE_text) -- Team col
if show_played then
tt = p_sub.colhead(tt,32score_width,played_head_text) -- Matches played col
end
if full_table then
tt = p_sub.colhead(tt,32score_width,win_head_text) -- Win col
if show_OTwin then tt = p_sub.colhead(tt,32score_width,OTwin_head_text) end
if show_PKwin then tt = p_sub.colhead(tt,32score_width,PKwin_head_text) end
if show_draw then
tt = p_sub.colhead(tt,32score_width,'<abbr title="Drawn">D</abbr>') -- Draw col
end
if show_OTloss and not OTloss_after then t = p_sub.colhead(tt,32score_width,OTloss_head_text) end
if show_PKloss and not PKloss_after then t = p_sub.colhead(tt,32score_width,PKloss_head_text) end
tt = p_sub.colhead(tt,32score_width,loss_head_text) -- Loss col
if show_OTloss and OTloss_after then t = p_sub.colhead(tt,32score_width,OTloss_head_text) end
if show_PKloss and PKloss_after then t = p_sub.colhead(tt,32score_width,PKloss_head_text) end
if show_tiebr then t = p_sub.colhead(tt,32score_width,tiebr_head_text) end
if not hide_for_against then
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_plur..' for">'..fa_letter..'F</abbr>') -- For col
tt = p_sub.colhead(tt,32score_width,'<abbr title="'..fa_word_plur..' againstfor">'..fa_letter..'AF</abbr>') -- AgainstFor col
tt = p_sub.colhead(tt,32score_width,'<abbr title="'..fa_word_plur..' foragainst">'..fa_letter..'FA</abbr>') -- ForAgainst col
if do_ratio or do_average then
if do_ratio or do_average then
local ratio_word = do_ratio and ' ratio' or ' average'
local ratio_letter = do_ratio and 'R' or 'Av'
tt = p_sub.colhead(tt,36,'<abbr title="'..fa_word_sing..ratio_word..'">'..fa_letter..ratio_letter..'</abbr>') -- Ratio col
elseif do_percentage then
tt = p_sub.colhead(tt,28,'<abbr title="'..fa_word_sing..' percentage">%</abbr>') -- Percentage col
else
tt = p_sub.colhead(tt,32score_width,'<abbr title="'..fa_word_sing..' difference">'..fa_letter..'D</abbr>') -- Difference col
end
end
end
Line 141 ⟶ 150:
end
if show_points then
tt = p_sub.colhead(tt,32score_width,'<abbr title="Points">Pts</abbr>') -- Points col
end
if show_perc then
Line 221 ⟶ 230:
end
ppg = mm._precision_format(points / matches, 2)
end
 
-- Show for/against
local for_against_style = Args['for_against_style'] or 'goals'
local hide_for_against = false
for_against_style = string.lower(for_against_style)
if for_against_style=='none' then
hide_for_against = true
end
 
Line 310 ⟶ 327:
local rank_points, rank_perc, rank_ppg = false, false, false
local win_fw, win_string
local for_style, points_style = '', ''
ranking_style = string.lower(ranking_style)
if ranking_style=='w' or ranking_style=='win' or ranking_style=='wins' then
Line 329 ⟶ 347:
rank_perc = true
rank_points = true
points_style = 'font-weight:bold;'
win_fw=ii_fw
win_string = ''
Line 335 ⟶ 354:
rank_ppg = true
rank_points = true
points_style = 'font-weight:bold;'
win_fw=ii_fw
win_string = ''
elseif ranking_style=='none' then
win_fw=ii_fw
win_string = ''
elseif ranking_style=='forpts' then
-- Based on goals for and points
rank_points = true
points_style = 'font-weight:bold;'
for_style = 'font-weight:bold;'
win_fw=ii_fw
win_string = ''
Line 343 ⟶ 370:
-- Based on points
rank_points = true
points_style = 'font-weight:bold;'
win_fw=ii_fw
win_string = ''
Line 395 ⟶ 423:
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..tiebr..'\n') -- Tie breaker
end
if not hide_for_against then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gfor..'\n') -- GF
table.insert(t,'| style="'..ii_fw..bg_col..for_style..'" |'..gaiggfor..'\n') -- GAGF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gcompgaig..'\n') -- Goal comparisonGA
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gforgcomp..'\n') -- GFGoal comparison
end
end
if show_bonus_points then
Line 410 ⟶ 440:
-- Add &minus; for negative point totals
if points<0 then
table.insert(t,'| style="font-weight: bold;'..points_style..bg_col..'" | &minus;'..-points..hth_string..'\n')
else
table.insert(t,'| style="font-weight: bold;'..points_style..bg_col..'" | '..points..hth_string..'\n')
end
elseif rank_perc then