Content deleted Content added
adjust total matches |
update with improvements from Module:Sports table/WDL |
||
Line 20:
local PKwin_head_text = Args['PKwin_header'] or '<abbr title="Won on penalty kicks">PKW</abbr>'
local PKloss_head_text = Args['PKloss_header'] or '<abbr title="Lost on penalty kicks">PKL</abbr>'
local show_draw = yesno(Args['show_draw'] or 'yes')
-- Use points instead of goals for/against
local for_against_style = Args['for_against_style'] or 'goals'
Line 66 ⟶ 67:
if show_OTwin then tt = p_sub.colhead(tt,32,OTwin_head_text) end
if show_PKwin then tt = p_sub.colhead(tt,32,PKwin_head_text) end
tt = p_sub.colhead(tt,32,'<abbr title="Drawn">D</abbr>') -- Draw col
end
if show_OTloss then t = p_sub.colhead(tt,32,OTloss_head_text) end
if show_PKloss then t = p_sub.colhead(tt,32,PKloss_head_text) end
Line 111 ⟶ 114:
local PKlosses = tonumber(Args['PKloss_'..team_code_ii]) or 0
local losses = tonumber(Args['loss_'..team_code_ii]) or 0
local gfor = tonumber(Args['gf_'..team_code_ii]
local gaig = tonumber(Args['ga_'..team_code_ii]
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
Line 120 ⟶ 123:
+ OTloss_points*OTlosses + loss_points*losses
+ PKwin_points*PKwins + PKloss_points*PKlosses + s_pts
-- Comparison of for against
local gcomp
Line 128 ⟶ 131:
if yesno(use_ratio_val) then
-- Now it is the goal ratio/goal average
if (gfor == '?') or (gaig == '?') or (gaig == 0) then
gcomp = '—'
else
Line 135 ⟶ 138:
else
-- It's goal difference
gcomp = '—'
-- Formatting with signs▼
else
▲ if gcomp>0 then
gcomp =
▲ -- Formatting with signs
elseif gcomp < 0 then▼
if gcomp
gcomp='+'..gcomp
▲ elseif gcomp < 0 then
gcomp='−'..-gcomp
end
end
end
-- Use actual values if gfor or gaig is not numeric
if (gfor == '?') then gfor = Args['gf_'..team_code_ii] or Args['pf_'..team_code_ii] or '' end
if (gaig == '?') then gaig = Args['ga_'..team_code_ii] or Args['pa_'..team_code_ii] or '' end
-- Whether to show the OT win and OT loss and draw columns
local show_OTwin = yesno(Args['showOTwin'] or 'yes')
local show_OTloss = yesno(Args['showOTloss'] or 'yes')
local show_PKwin = yesno(Args['showPKwin'] or 'no')
local show_PKloss = yesno(Args['showPKloss'] or 'no')
local show_draw = yesno(Args['show_draw'] or 'yes')
-- Some local vars
Line 167 ⟶ 178:
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..PKwins..'\n') -- Won on PKs
end
if show_draw then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..draws..'\n') -- Drawn
end
if show_OTloss then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..OTlosses..'\n') -- Lost in OT
Line 197 ⟶ 210:
-- Or functionality will be compromised
-- ------------------------------------------------------------
local status_code, status_called = {}, {}
status_code = { A='Advances to a further round', C='Champion', D='Disqualified',
E='Eliminated', H='Host', O='Play-off winner', P='Promoted', Q='Qualified to the phase indicated',
R='Relegated', T='Qualified, but not yet to the particular phase indicated'
local status_letters = (Args['status_order'] or '') .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-- Status position (before or after read and default)
Line 215 ⟶ 225:
status_position = 'after'
end
-- Read in custom status options
for l in mw.text.gsplit(status_letters, '') do
status_called[l] = false
status_letters = mw.ustring.gsub(status_letters, '(' .. l ..'.-)' .. l, '%1')
if Args['status_text_' .. l] then
status_code[l] = Args['status_text_' .. l]
end
end
return {code=status_code, called=status_called, letters=status_letters, position=status_position}
|