Module:Sports table/WDL OT: Difference between revisions

Content deleted Content added
m partial rvgf. Change the abbreviation titles rather than the abbreviations themselves.
fix div by zero
Line 183:
end
 
--Some sports use draw as well
local percentage_format = Args['percentage_format']
local point_perc = ''
if percentage_formattonumber(matches) == 'hundrednil 1or decimal'(matches*win_points) == 0 then
point_perc = mm._precision_format(((points) / (matches*win_points)*100), 1)
elseif percentage_format == 'hundred 2 decimals' then
point_perc = mm._precision_format(((points) / (matches*win_points)*100), 2)
else
point_perc = mm._precision_format((points) / (matches*win_points), 3)
percentage_format = 'no'
end
if matches == 0 then
-- Escape for zero matches
point_perc = '—'
else
elseif points ~= (matches*win_points) and percentage_format == 'no' then
if percentage_format == 'hundred 1 decimal' then
-- Drop the leading zero (from the string)
point_perc = mm._precision_format(((points) / (matches*win_points)*100), 1)
point_perc = string.sub(point_perc,2,string.len(point_perc))
elseif percentage_format == 'hundred 2 decimals' then
point_perc = mm._precision_format(((points) / (matches*win_points)*100), 2)
else
point_perc = mm._precision_format((points) / (matches*win_points), 3)
percentage_format = 'no'
end
elseif if points ~= (matches*win_points) and percentage_format == 'no' then
-- Drop the leading zero (from the string)
point_perc = string.sub(point_perc,2,string.len(point_perc))
end
end