Module:Sandbox/B2project/WLT: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(42 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 tie_head_textpld_head_text = Args['tie_headerpld_header'] or '<abbr title="TiePlayed">TPld</abbr>'
local tiebr_head_textOTloss_head_text = Args['tiebr_headerOTloss_header'] or '<abbr title="RegulationLost andin overtime wins">ROWOTL</abbr>'
local gp_head_texttiebr_head_text = Args['played_headertiebr_header'] or '<abbr title="Games playedTiebreaker">GPTBR</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>'
local gp_head_text = Args['played_header'] or '<abbr title="Games played">GP</abbr>'
-- Use points instead of goals for/against
local for_against_style = Args['for_against_style'] or 'goals'
Line 46 ⟶ 48:
-- True if exist, false otherwise
if yesno(use_ratio_val) then do_ratio = true end
-- Whether tiebreakerto isuse neededtiebreak
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)
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_plur..' forTies">'..fa_letter..'FT</abbr>') -- For colTies
if not do_tiebr then
tt = p_sub.colhead(tt,32,tiebr_head_text) -- tiebr
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
if not do_ratio then
tt = p_sub.colhead(tt,32,'<abbr title="'..fa_word_sing..' difference">'..fa_letter..'D</abbr>') -- Difference col
else
tt = p_sub.colhead(tt,36,'<abbr title="'..fa_word_sing..' ratio">'..fa_letter..'R</abbr>') -- Ratio col
end
tt = p_sub.colhead(tt,32,OTloss_head_text)
if not do_ratiodo_tiebr then
tt = p_sub.colhead(tt,32,tie_head_texttiebr_head_text)
end
else
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 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 tiesOTlosses = tonumber(Args['tie_OTloss_'..team_code_ii]) or 0
if not do_tiebr then
local tiebrties = tonumber(Args['tiebr_ties_'..team_cone_iiteam_code_ii]) or 0
local hth_localtiebr_val = tonumber(Args['hth_tiebr_'..team_code_ii] ) or nil0
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 119 ⟶ 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
else
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
local s_pts = tonumber(Args['adjust_points_'..team_code_ii]) or tonumber(Args['startpoints_'..team_code_ii]) or 0
local hth_local = Args['hth_'..team_code_ii] or nil
-- Then calculate some values
local matches = wins + ties + losses
local points = win_points*wins + tie_points*ties + loss_points*losses + s_pts
end
-- Comparison of for against
Line 152 ⟶ 146:
gcomp='&minus;'..-gcomp
end
end
 
-- Whether to use tiebreak
local use_tiebr_val = Args['use_tiebreak'] or 'yes'
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 166 ⟶ 170:
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..'" |'..OTlosses..'\n') -- Lost in OT
if not do_tiebr then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..tiebr_val..'\n') -- Tiebreaker value
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gfor..'\n') -- GF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gaig..'\n') -- GA
Line 190 ⟶ 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 204 ⟶ 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}