Module:Sports table/Badminton individual: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(10 intermediate revisions by 3 users not shown)
Line 37:
local fa_letter, fa_word_sing, fa_word_plur
local hide_for_against = false
 
-- First convert to lower case if it is a string
-- Use points instead of point for/against
for_against_style = string.lower(for_against_style)
local game_for_against_style = Args['game_for_against_style'] or 'games'
if for_against_style=='s' or for_against_style=='set' or for_against_style=='sets' then
local gfa_letter, gfa_word_sing, gfa_word_plur
fa_letter = 'S'
local hide_game_for_against = false
fa_word_sing = 'Set'
-- First convert to lower case if it is a string
fa_word_plur = 'Sets'
elseif for_against_style =='none' thenstring.lower(for_against_style)
if game_for_against_style=='g' or game_for_against_style=='game' or game_for_against_style=='games' then
hide_for_against = true
gfa_letter = 'G'
else
fa_letter gfa_word_sing = 'SGame'
fa_word_sing gfa_word_plur = 'SetGames'
elseif game_for_against_style=='none' then
fa_word_plur = 'Sets'
hide_game_for_against = true
end
else
gfa_letter = 'G'
gfa_word_sing = 'Game'
gfa_word_plur = 'Games'
end
-- Whether to use goal ratio (goal average) instead
local use_ratio_val = Args['use_goal_ratio'] or 'no'
local do_ratio = false
-- True if exist, false otherwise
if yesno(use_ratio_val) then do_ratio = true end
-- Whether to use goal percentage instead
local use_percentage_val = Args['use_goal_percentage'] or 'no'
local do_percentage = false
-- True if exist, false otherwise
if yesno(use_percentage_val) then do_percentage = true end
-- Use points instead of point for/against
Line 111 ⟶ 116:
tt = p_sub.colhead(tt,20,'<abbr title="Lost">L</abbr>') -- Loss col
end
if not hide_for_against then
tt = p_sub.colhead(tt,20,'<abbr title="'..fa_word_plur..' for">'..fa_letter..'F</abbr>') -- For col
tt = p_sub.colhead(tt,20,'<abbr title="'..fa_word_plur..' against">'..fa_letter..'A</abbr>') -- Against col
if do_ratio then
tt = p_sub.colhead(tt,20,'<abbr title="'..fa_word_sing..' ratio">'..fa_letter..'R</abbr>') -- Ratio col
elseif do_percentage then
tt = p_sub.colhead(tt,20,'<abbr title="'..fa_word_sing..' percentage">%</abbr>') -- Percentage col
else
tt = p_sub.colhead(tt,20,'<abbr title="'..fa_word_sing..' difference">'..fa_letter..'D</abbr>') -- Difference col
end
if not hide_game_for_against then
tt = p_sub.colhead(tt,20,'<abbr title="'..gfa_word_plur..' for">'..gfa_letter..'F</abbr>') -- For col
Line 142 ⟶ 137:
tt = p_sub.colhead(tt,20,'<abbr title="'..pfa_word_sing..' difference">'..pfa_letter..'D</abbr>') -- Difference col
end
end
end
end
Line 189 ⟶ 184:
--Some sports use draw as well
local win_perc = mm._precision_format((2*wins) / (2*matches), 3)''
if matches == 0 then
-- Escape for zero matches
win_perc = '&mdash;'
else
elseif losses > 0 then
win_perc = mm._precision_format((2*wins) / (2*matches), 3)
-- Drop the leading zero (from the string)
if do_ratiolosses > 0 then
win_perc = string.sub(win_perc,2,string.len(win_perc))
-- Drop the leading zero (from the string)
win_perc = string.sub(win_perc,2,string.len(win_perc))
end
end
Line 336 ⟶ 334:
if not hide_for_against then
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..mfor..'\n') -- MF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..maig..'\n') -- MA
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..mcomp..'\n') -- Match comparison
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gfor..'\n') -- GF
table.insert(t,'| style="'..ii_fw..bg_col..'" |'..gaig..'\n') -- GA
Line 369 ⟶ 364:
local status_code, status_called = {}
status_code = { A='Advance to a further round', C='Champion', D='Disqualified',
E='Eliminated', G='Guest', H='Host', N='Did not start', O='Play-off winner',
P='Promoted', Q='Qualified to the phase indicated', R='Relegated',
R='Relegated', T='Qualified, but not yet to the particular phase indicated',
X='?', Y='?', Z='?'}
status_called = { A=false, C=false, D=false, E=false, G=false, H=false, ON=false, PO=false,
P=false, Q=false, R=false, T=false, X=false, Y=false, Z=false}
local status_letters = 'ACDEGHOPQRTXYZACDEGHNOPQRTXYZ'
-- Status position (before or after read and default)