Content deleted Content added
SocietyBox (talk | contribs) m balls_per_over default |
No edit summary Tags: Mobile edit Mobile web edit |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 2:
local pp = { }
local function args_points(Args)
local pts = {}
pts.bonus = tonumber(Args['bonuspoints']) or 1
pts.loss = tonumber(Args['losspoints']) or 0
return pts
end
local function abbr_header(txt, abbr, show_header_pts, pts)
if show_header_pts then
txt = txt .. ' – ' .. pts .. (pts == 1 and ' point' or ' points')
end
return '<abbr title="' .. txt .. '">' .. abbr .. '</abbr>'
end
function pp.header(t, Args, p_sub, pos_label, group_col, VTE_text, full_table, results_header_txt)
Line 21 ⟶ 42:
--Header specific options
local pts = args_points(Args)
local group_head_text = Args['group_header'] or '<abbr title="Group">Grp</abbr>'
local team_head_text = Args['team_header'] or 'Team'
local
local
local nr_head_text = Args['nr_header'] or abbr_header('No result', 'NR', show_pts, pts.nr)
local bonus_head_text = Args['bonus_header'] or '<abbr title="Bonus points">BP</abbr>'
local deduct_head_text = Args['deduct_header'] or '<abbr title="Deductions">Ded</abbr>'
Line 30 ⟶ 55:
--
local loss_first = yesno(Args['loss_before_tie'] or 'yes')
local show_draw = yesno(Args['draw_tie'] or 'yes')
local show_tie = yesno(Args['show_tie'] or 'yes')
local show_nr = yesno(Args['show_nr'] or 'yes')
Line 36 ⟶ 62:
local show_nrr = yesno(Args['show_nrr'] or 'yes')
local show_nrr_fa = yesno(Args['show_nrr_fa'] or 'no') and show_nrr
▲ --local ranking_style = Args['ranking_style'] or 'pts'
-- Initialize
Line 62 ⟶ 85:
if full_table then
tt = p_sub.colhead(tt,28,abbr_header('
local loss_head_text = abbr_header('Lost', 'L', show_pts, pts.loss)
if loss_first then
tt = p_sub.colhead(tt,28,
if show_tie then
Line 75 ⟶ 99:
end
tt = p_sub.colhead(tt, 28,
end
if show_nr then
Line 121 ⟶ 145:
local mm = require('Module:Math')
local yesno = require('Module:Yesno')
▲ -- Do not change these defaults without first checking which tables use them
▲ local win_points = tonumber(Args['winpoints']) or 2
▲ local tie_points = tonumber(Args['tiepoints']) or 1
▲ local nr_points = tonumber(Args['nrpoints']) or 1
▲ local loss_points = tonumber(Args['losspoints']) or 0
-- table options, to match those in the header
Line 150 ⟶ 166:
local oversbowled = tonumber(Args['ob_'..team_code_ii]) or 0
local runsconceded = tonumber(Args['rc_'..team_code_ii]) or 0
local
local runsscored = tonumber(Args['rs_'..team_code_ii]) or 0
local balls_per_over = tonumber(Args['balls_per_over']) or 6
Line 159 ⟶ 175:
local matches = wins + losses + ties + noresults
local
local s_bps = pts.bonus*bonuses
local points =
-- Some local vars
Line 192 ⟶ 209:
end
local nrr_for = rr_to_dec(runsscored,
local nrr_against = rr_to_dec(runsconceded, oversbowled, balls_per_over)
Line 198 ⟶ 215:
if nrr ~= nil then
nrr = mm._precision_format(nrr, 3)
elseif (oversbowled == 0) or (
nrr = '—'
else
Line 253 ⟶ 270:
end
if show_nrr_fa then
local nrr_for_text =
local nrr_against_text = oversbowled > 0 and runsconceded..'/'..oversbowled or '—'
table.insert(t, '| data-sort-value="'..nrr_for..'" style="'..ii_fw..bg_col..'" |'..nrr_for_text..'\n')
Line 271 ⟶ 288:
local status_code, status_called = {},{}
status_code = { A='Advances to a further round', C='
E='Eliminated', G='Guest', H='Host', O='Play-off winner', P='Promoted', Q='Qualified
R='
local status_letters = (Args['status_order'] or '') .. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|