Content deleted Content added
No edit summary |
Sports2021 (talk | contribs) mNo edit summary |
||
(25 intermediate revisions by 2 users not shown) | |||
Line 9:
-- Pre stuff
local team_width = Args['teamwidth'] or '190'
local group_width = Args['groupwidth'] or '28'
local score_width = Args['scorewidth'] or '28'
local sort_text = yesno(Args['sortable_table'] or 'no') and ' sortable' or ''
local show_played = not yesno(Args['hide_played'] or 'no')
Line 78 ⟶ 80:
local do_scored = yesno(Args['use_goals_scored'] or 'no')
-- Whether to show totals instead of
local only_totals = yesno(Args['only_totals'] or 'no')
-- Whether to show totals instead of conference and overall
local only_conference = yesno(Args['only_conference'] or 'no')
-- Whether to show for against/totals instead of home/away for/against
Line 88 ⟶ 93:
-- Spacer style
local sps = only_totals and '' or only_conference and '' or ' style="border-width:1px 1px 1px 3px;"'
-- Initialize
Line 100 ⟶ 105:
-- Add group header
if full_table and group_col then
tt = p_sub.colhead(tt,
end
tt = p_sub.colhead(tt,team_width,team_head_text..VTE_text) -- Team col
if show_played then
tt = p_sub.colhead(tt,
end
if full_table then
local lbls = only_totals and {{'', 'Total '}} or only_conference and {{'', 'Conference '}} or {{'C', 'Conference '}, {'', 'Total '}}
for k,v in ipairs(lbls) do
local apre, tpre = v[1], v[2]
tt = p_sub.colhead(tt,
if loss_first then
tt = p_sub.colhead(tt,
if show_tie then
tt = p_sub.colhead(tt,
end
else
if show_tie then
tt = p_sub.colhead(tt,
end
tt = p_sub.colhead(tt,
end
if rounds_won then
tt = p_sub.colhead(tt,
end
if not hide_for_against and not only_fa_totals then
tt = p_sub.colhead(tt,
tt = p_sub.colhead(tt,
end
if show_perc then
Line 135 ⟶ 140:
tt = p_sub.colhead(tt,36,'<abbr title="'..tpre..'win percentage">'..apre..'PCT</abbr>')
end
tt = p_sub.colhead(tt,28,'<abbr title="Games behind">GB</abbr>')▼
end
end
Line 156 ⟶ 164:
end
end
▲ end
▲ if show_GB then -- Games behind header
▲ tt = p_sub.colhead(tt,28,'<abbr title="Games behind">GB</abbr>')
end
if show_bonus_points then
Line 189 ⟶ 194:
-- Order of ties and losses --
local loss_first = Args['loss_before_tie'] or
-- Optional rounds won
Line 195 ⟶ 200:
-- Get some input
local cwins = (tonumber(Args['cwin_'..team_code_ii]) or 0)
local ncwins = (tonumber(Args['ncwin_'..team_code_ii]) or 0)
local wins = cwins + ncwins
local cties = (tonumber(Args['ctie_'..team_code_ii]) or 0)
local ncties = (tonumber(Args['nctie_'..team_code_ii]) or 0)
local ties = cties + ncties
local closses = (tonumber(Args['closs_'..team_code_ii]) or 0)
local nclosses = (tonumber(Args['ncloss_'..team_code_ii]) or 0)
local losses = closses + nclosses
local crw = (tonumber(Args['crw_'..team_code_ii]) or 0)
local ncrw = (tonumber(Args['ncrw_'..team_code_ii]) or 0)
local rw = crw + ncrw
Line 226 ⟶ 231:
-- Then calculate some values
local matches = wins + ties + losses
if yesno(Args['only_conference'] or 'no') then
matches = cwins + cties + closses
end▼
local points = cwin_points*cwins + ncwin_points*ncwins + tie_points*ties + loss_points*losses + rw_points*rw + s_pts
Line 232 ⟶ 240:
end
local show_tie = yesno(Args['show_tie'] or 'no')
▲ end
local win_perc = ''
local cwin_perc = ''
local include_ties = yesno(Args['include_ties'] or 'yes')
if tonumber(matches) == nil or matches == 0 then
-- Escape for zero matches
Line 245 ⟶ 249:
else
--Some sports use tie as well
if include_ties then
win_perc = mm._precision_format((2*wins + ties) / (2*matches), 3)
else
if losses > 0 then
-- Drop the leading zero (from the string)
Line 256 ⟶ 264:
else
--Some sports use tie as well
if include_ties then
▲ cwin_perc = mm._precision_format((2*cwins + cties) / (2*(cwins+cties+closses)), 3)
cwin_perc = mm._precision_format((2*cwins + cties) / (2*(cwins+cties+closses)), 3)
else
cwin_perc = mm._precision_format(cwins / (cwins+closses), 3)
end
if closses > 0 then
-- Drop the leading zero (from the string)
Line 325 ⟶ 337:
-- Do nothing, it's vs this team
else
local wins_GB = (tonumber(Args['cwin_'..team_list[GB_team_no]]) or 0)
local local
▲ local GB_num = (wins_GB-wins+losses-losses_GB)/2 + (ties_GB - ties)
-- Display options
if GB_num >0 then
Line 379 ⟶ 391:
-- Whether to show totals instead of home and away
local only_totals = yesno(Args['only_totals'] or 'no')
-- Whether to show totals instead of home and away
local only_conference = yesno(Args['only_conference'] or 'no')
-- Spacer style
local sps = only_totals and '' or only_conference and '' or 'border-width:1px 1px 1px 3px;'
-- Row building
if show_played then
Line 398 ⟶ 412:
nclosses = numorval(Args['ncloss_'..team_code_ii])
end
local stats = only_totals and {{wins, ties, losses, rw, gfor, gaig}} or
only_conference and {{
{{cwins, cties, closses, crw, cgfor, cgaig, cwin_perc}, {wins, ties, losses, rw, gfor, gaig, win_perc}}
local first_pass = true
Line 426 ⟶ 440:
if first_pass then
table.insert(t,'| style="font-weight: bold;'..bg_col..'" | '..(v[7])..hth_string..'\n')
first_pass = false▼
else
table.insert(t,'| style="'..bg_col..'" | '..(v[7])..'\n')
end
end
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..GB_text..'\n') -- GB▼
end
end
if not hide_for_against then
Line 441 ⟶ 458:
table.insert(t,'| style="'..lsps..ii_fw..bg_col..'" |'..gcomp..'\n') -- Goal comparison
end
▲ end
▲ if show_GB then
▲ table.insert(t,'| style="'..ii_fw..bg_col..'" |'..GB_text..'\n') -- GB
end
if show_bonus_points then
Line 472 ⟶ 485:
local status_code, status_called = {}, {}
status_code = { A='Advance to a further round', C='Champion', D='Disqualified',
E='Eliminated', G='Guest', H='Host', O='Play-off winner', P='Promoted', Q='Qualified
R='Relegated', T='Qualified, but not yet
local status_letters = (Args['status_order'] or '') .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|