Module:Sandbox/B2project/WLT: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(18 intermediate revisions by the same user not shown)
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 tiebr_head_textOTloss_head_text = Args['tiebr_headerOTloss_header'] or '<abbr title="RegulationLost andin overtime wins">ROWOTL</abbr>'
local tie_head_texttiebr_head_text = Args['tie_headertiebr_header'] or '<abbr title="TieTiebreaker">TTBR</abbr>'
local group_head_text = Args['group_header'] or '<abbr title="Group">Grp</abbr>'
local tie_head_text = Args['tie_header'] or '<abbr title="Tie">T</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 'noyes'
local do_tiebr = false
if yesno(use_tiebr_val) then do_tiebr = true end
-- Ties and OTL
local use_tieOTL_val = Args['use_ties'] or 'no'
local do_ties = false
if yesno(use_tieOTL_val) then do_ties = true end
-- Initialize
Line 60 ⟶ 67:
-- 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
if not do_tiebrdo_ties then
tt = p_sub.colhead(tt,32,tie_head_text'<abbr title="Ties">T</abbr>') -- Ties
if not do_tiebr then
end
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>'OTloss_head_text) -- Against col
if not do_ratiodo_tiebr then
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_sing..' difference">'..fa_letter..'D</abbr>'tiebr_head_text) -- Difference col
else
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 84 ⟶ 87:
else
tt = p_sub.colhead(tt,36,'<abbr title="'..fa_word_sing..' ratio">'..fa_letter..'R</abbr>') -- Ratio col
end
end
end
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 OTloss_points = tonumber(Args['OTlosspoints']) or 1
local tie_pointsties_points = tonumber(Args['tiepoints']) 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 OTlosses = tonumber(Args['OTloss_'..team_code_ii]) or 0
local ties = tonumber(Args['tie_ties_'..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 ⟶ 122:
local hth_local = Args['hth_'..team_code_ii] or nil
-- Then calculate some values
local matches = wins + tieslosses + lossesOTlosses + ties
local points = win_points*wins + tie_pointsloss_points*tieslosses + loss_pointsOTloss_points*lossesOTlosses + s_pts + ties_points*ties
local tiebr = tonumber(Args['tiebr_'..team_code_ii]) or 0
 
-- Comparison of for against
local gcomp
Line 145 ⟶ 149:
 
-- Whether to use tiebreak
local use_tiebr_val = Args['use_tiebruse_tiebreak'] or 'noyes'
local do_tiebr = false
if yesno(use_tiebr_val) then do_tiebr = true end
-- Ties and OTL
local use_tieOTL_val = Args['use_ties'] or 'no'
local do_ties = false
if yesno(use_tieOTL_val) then do_ties = true end
-- Some local vars
Line 159 ⟶ 168:
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
if do_ties then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..ties..'\n') -- TieTies
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..lossesOTlosses..'\n') -- Lost in OT
if not do_tiebr then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..winstiebr_val..'\n') -- WonTiebreaker value
end
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..'" |'..wins..'\n') -- Won
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..'" |'..ties..'\n') -- Tiebreak
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
end
end
-- Add &minus; for negative point totals
Line 195 ⟶ 200:
-- ------------------------------------------------------------
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 ⟶ 214:
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}