Module:Sandbox/B2project/WLT: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 10:
local team_width = Args['teamwidth'] or '190'
local sort_text = ''
local sort_table_val = Args['sortable_table'] or 'yesno'
if yesno(sort_table_val) then sort_text = 'sortable' end
table.insert(t,'{|class="wikitable '..sort_text..'" style="text-align:center;"\n') -- Open table
 
-- Custom header options
-- Table header
local table_header = Args['table_header']
if table_header then
table.insert(t,'|+'..table_header..'\n')
end
--Column headers
local gp_head_textpld_head_text = Args['played_headerpld_header'] or '<abbr title="Games playedPlayed">GPPld</abbr>'
local tie_head_textOTloss_head_text = Args['tie_headerOTloss_header'] or '<abbr title="Lost in overtime">OTL</abbr>'
local tiebr_head_text = Args['tiebr_header'] or '<abbr title="Regulation and overtime winsTiebreaker">ROWTBR</abbr>'
local group_head_text = Args['group_header'] or '<abbr title="Group">Grp</abbr>'
local tie_head_text = Args['tie_header'] or '<abbr title="Lost in overtime">OTL</abbr>'
local tiebr_head_text = Args['tiebr_header'] or '<abbr title="Regulation and overtime wins">ROW</abbr>'
-- Use points instead of goals for/against
local for_against_style = Args['for_against_style'] or 'goals'
Line 48 ⟶ 50:
-- Whether to use tiebreak
local use_tiebr_val = Args['use_tiebruse_tiebreak'] or 'yes'
local do_tiebr = false
if yesno(use_tiebr_val) then do_tiebr = true end
Line 60 ⟶ 62:
-- Add group header
if full_table and group_col then
tt = p_sub.colhead(tt,2832,group_head_text) -- Group/division col
end
tt = p_sub.colhead(tt,team_width,'Team'..VTE_text) -- Team col
tt = p_sub.colhead(tt,32,gp_head_textpld_head_text) -- Matches played col
if full_table then
tt = p_sub.colhead(tt,32,'<abbr title="Won">W</abbr>') -- Win col
tt = p_sub.colhead(tt,32,'<abbr title="Lost">L</abbr>') -- Loss col
tt = p_sub.colhead(tt,32,tie_head_textOTloss_head_text)
if not do_tiebr then
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_plur..' for">'..fa_letter..'F</abbr>') -- For col
Line 76 ⟶ 78:
tt = p_sub.colhead(tt,36,'<abbr title="'..fa_word_sing..' ratio">'..fa_letter..'R</abbr>') -- Ratio col
end
else
tt = p_sub.colhead(tt,32,tiebr_head_text) -- Tiebreak col
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_plur..' for">'..fa_letter..'F</abbr>') -- For col
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_plur..' against">'..fa_letter..'A</abbr>') -- Against col
Line 105 ⟶ 107:
-- Get custom/default options for in table
local win_points = tonumber(Args['winpoints']) or 2
local tie_points = tonumber(Args['tiepoints']) or 1
local loss_points = tonumber(Args['losspoints']) or 0
local tie_pointsOTloss_points = tonumber(Args['tiepointsOTlosspoints']) or 1
-- Get some input
local wins = tonumber(Args['win_'..team_code_ii]) or 0
local ties = tonumber(Args['tie_'..team_code_ii]) or 0
local losses = tonumber(Args['loss_'..team_code_ii]) or 0
local tiesOTlosses = tonumber(Args['tie_OTloss_'..team_code_ii]) or 0
local tiebrtiebr_val = tonumber(Args['tiebr_'..team_code_ii]) or 0
local gfor = tonumber(Args['gf_'..team_code_ii]) or tonumber(Args['pf_'..team_code_ii]) or 0
local gaig = tonumber(Args['ga_'..team_code_ii]) or tonumber(Args['pa_'..team_code_ii]) or 0
Line 117 ⟶ 120:
local hth_local = Args['hth_'..team_code_ii] or nil
-- Then calculate some values
local matches = wins + tieslosses + lossesOTlosses
local points = win_points*wins + tie_pointsloss_points*tieslosses + loss_pointsOTloss_points*lossesOTlosses + s_pts
local tiebr = tonumber(Args['tiebr_'..team_code_ii]) or 0
 
-- Comparison of for against
local gcomp
Line 145 ⟶ 147:
 
-- Whether to use tiebreak
local use_tiebr_val = Args['use_tiebruse_tiebreak'] or 'yes'
local do_tiebr = false
if yesno(use_tiebr_val) then do_tiebr = true end
Line 159 ⟶ 161:
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..matches..'\n') -- Played
if full_table then
if not do_tiebr then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..wins..'\n') -- Won
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..losses..'\n') -- Lost
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..tiesOTlosses..'\n') -- TieLost in OT
if not do_tiebr then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gfor..'\n') -- GF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gaig..'\n') -- GA
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gcomp..'\n') -- Goal comparison
else
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..winstiebr_val..'\n') -- WonTiebreaker value
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..losses..'\n') -- Lost
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..ties..'\n') -- Tie
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..tiebr..'\n') -- Tiebreak
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gfor..'\n') -- GF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gaig..'\n') -- GA
Line 195 ⟶ 194:
-- ------------------------------------------------------------
local status_code, status_called = {}
status_code = { PE='PresidentsEliminated Trophyfrom playoff contention', XP='Clinched playoffPresidents spotTrophy' },
X='Clinched playoff spot', Y='Clinched division', Z='Clinched conference'}
status_called = { A=false, C=false, D=false, E=false, H=false, O=false, P=false,
Q status_called =false, R{E=false, TP=false, X=false, Y=false, Z=false}
local status_letters = 'ACDEHOPQRTXYZEPXYZ'
-- Status position (before or after read and default)
Line 209 ⟶ 208:
status_position = 'after'
end
-- Read in custom status options
if Args['status_text_X'] then status_code.X = Args['status_text_X'] end
if Args['status_text_Y'] then status_code.Y = Args['status_text_Y'] end
if Args['status_text_Z'] then status_code.Z = Args['status_text_Z'] end
return {code=status_code, called=status_called, letters=status_letters, position=status_position}