Module:Sports table/College: Difference between revisions

Content deleted Content added
No edit summary
mNo edit summary
 
(15 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 103 ⟶ 105:
-- Add group header
if full_table and group_col then
tt = p_sub.colhead(tt,28group_width,group_head_text) -- Group col
end
tt = p_sub.colhead(tt,team_width,team_head_text..VTE_text) -- Team col
if show_played then
tt = p_sub.colhead(tt,28score_width,played_head_text) -- Matches played col
end
if full_table then
Line 113 ⟶ 115:
for k,v in ipairs(lbls) do
local apre, tpre = v[1], v[2]
tt = p_sub.colhead(tt,'28'score_width..sps,'<abbr title="'..tpre..'won">'..apre..'W</abbr>') -- Win col
if loss_first then
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..'lost">'..apre..'L</abbr>') -- Loss col
if show_tie then
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..'tied">'..apre..'T</abbr>') -- tie col
end
else
if show_tie then
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..'tied">'..apre..'T</abbr>') -- tie col
end
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..'lost">'..apre..'L</abbr>') -- Loss col
end
if rounds_won then
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..'rounds won">'..apre..'RW</abbr>') -- Rounds won
end
if not hide_for_against and not only_fa_totals then
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..fa_word_plur..' for">'..apre..fa_letter..'F</abbr>') -- For col
tt = p_sub.colhead(tt,28score_width,'<abbr title="'..tpre..fa_word_plur..' against">'..apre..fa_letter..'A</abbr>') -- Against col
end
if show_perc then
Line 138 ⟶ 140:
tt = p_sub.colhead(tt,36,'<abbr title="'..tpre..'win percentage">'..apre..'PCT</abbr>')
end
end
if show_GB and tpre=="Conference " then -- Games behind header
tt = p_sub.colhead(tt,28,'<abbr title="Games behind">GB</abbr>')
end
end
Line 159 ⟶ 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 198 ⟶ 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 228 ⟶ 230:
local hth_local = Args['hth_'..team_code_ii] or nil
-- Then calculate some values
local matches = wins + ties + losses
if yesno(Args['only_conference'] or 'no') then
local matches = cwins + cties + closses
else
local matches = wins + ties + losses
end
local points = cwin_points*cwins + ncwin_points*ncwins + tie_points*ties + loss_points*losses + rw_points*rw + s_pts
Line 239 ⟶ 240:
end
local show_tie = yesno(Args['show_tie'] or 'no')
if tonumber(Args['cwin_'..team_code_ii]) == nil or (show_tie and tonumber(Args['ctie_'..team_code_ii]) == nil)
or tonumber(Args['closs_'..team_code_ii]) == nil or tonumber(Args['ncwin_'..team_code_ii]) == nil
or (show_tie and tonumber(Args['nctie_'..team_code_ii]) == nil) or tonumber(Args['ncloss_'..team_code_ii]) == nil then
matches = tonumber(Args['matches_'..team_code_ii]) or 0
end
local win_perc = ''
Line 341 ⟶ 337:
-- Do nothing, it's vs this team
else
local wins_GB = (tonumber(Args['cwin_'..team_list[GB_team_no]]) or 0)
local +losses_GB = (tonumber(Args['ncwin_closs_'..team_list[GB_team_no]]) or 0)
local losses_GBties_GB = (tonumber(Args['closs_'..team_list[GB_team_no]]) or 0) + (tonumber(Args['ncloss_ctie_'..team_list[GB_team_no]]) or 0)
local GB_num = (wins_GB-winscwins+lossesclosses-losses_GB)/2 + (ties_GB - tiescties)
local ties_GB = (tonumber(Args['ctie_'..team_list[GB_team_no]]) or 0) + (tonumber(Args['nctie_'..team_list[GB_team_no]]) or 0)
local GB_num = (wins_GB-wins+losses-losses_GB)/2 + (ties_GB - ties)
-- Display options
if GB_num >0 then
Line 444 ⟶ 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
if show_GB and first_pass then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..GB_text..'\n') -- GB
end
first_pass = false
end
if not hide_for_against then
Line 459 ⟶ 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 489 ⟶ 484:
-- ------------------------------------------------------------
local status_code, status_called = {}, {}
status_code = { A='Advance to conferencea championshipfurther round', C='College Football Playoff championChampion', D='Disqualified',
E='Eliminated', G='Guest', H='Host', O='Play-off winner', P='Promoted', Q='Qualified tofor the phase indicated',R='Relegated',
R='Relegated', T='Qualified, but not yet tofor the particular phase indicated', X='Division champion', Y='Confernce champion',}
Z='College Football Playoff participant'
}
local status_letters = (Args['status_order'] or '') .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'