Module:RoundN: Difference between revisions

Content deleted Content added
mNo edit summary
fix sum box error when no scores provided
Line 362:
p.scoreBoxes = (tonumber(args:clean('score-boxes', {pattern = '%D'})) or 1) + sumBox
p.scoreSumBox = p.scoreBoxes > 0 and p.scoreSumBox or nil
local boxStyle = p.scoreBoxes > 1 and
(p.scoreSumBox and
setmetatable(
{{}, [p.scoreBoxes] = {'0 1ex'}},
{__call = function(t, i) if t[i] then return nil end return 0 end}
)
or setmetatable(
{},
{__call = function(t, i) return 0 end}
)
)
or setmetatable({}, {__call = function(t, i) return nil end})
p.colspan = p.scoreBoxes > 0 and (p.scoreBoxes + 1) or nil
local nodeArgs = {
Line 615 ⟶ 627:
clean = {}
}
local notSummed = not p.scoreSumBox or #m.nonEmpty ==< 12
for s, i in ipairs(m.nonEmpty) do
m.bold.clean[s] = {p.scoreWasher:main(args[i[1]]), p.scoreWasher:main(args[i[2]])}
Line 636 ⟶ 648:
teamBox(args[step + nodeArgs.team[m.phase]], m.r, setmetatable(base, {__index = {bold = m.bold.win(m.phase)}}))
if p.colspan then
if #not m.nonEmpty == 0[1] then
getmetatable(boxStyle).__index = nil
for s = 1, p.scoreBoxes do
teamBox('', m.r, setmetatable(base, p.scoreSumBoxes and {__index = {borderLeft = boxStyle(s)}}))
end
else
iflocal scoreBoxes = m.nonEmpty[1] and #m.nonEmpty <or p.scoreBoxes then
tab.r:attr{colspanif =scoreBoxes 1 +< p.scoreBoxes - #m.nonEmpty}then
tab.r:attr{colspan = 1 + p.scoreBoxes - scoreBoxes}
end
local thinLeftgetmetatable(boxStyle).__index = p.scoreSumBoxscoreSumBoxes and {[1scoreBoxes] = {}, boxStyle[#mp.nonEmptyscoreBoxes] = {'0 1ex'}} or {}
for s, i in ipairs(m.nonEmpty) do
teamBox(args[i[m.phase]], m.r, setmetatable(base, {__index = {'center', borderLeft = not thinLeft[boxStyle(s] and 0 or nil), sumBox = thinLeftboxStyle[s], bold = m.bold.box[s](m.phase)}}))
end
end