Jump to content

Module:Medals table and Module:Medals table/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
cast totals as numbers
 
No edit summary
 
Line 208: Line 208:
local isHost = args['host_' .. IOC]
local isHost = args['host_' .. IOC]
-- this is mainly for the parameter names example so you can override it.
-- this is mainly for the parameter names example so you can override it.
local total = tonumber(args['total_' .. IOC]) or (gold + silver + bronze)
local total = args['total_' .. IOC] or gold + silver + bronze
local color = isHost and hostColor or defaultRowColor
local color = isHost and hostColor or defaultRowColor


Line 262: Line 262:
:attr('scope', 'row')
:attr('scope', 'row')
:css('background-color', color)
:css('background-color', color)
:css('color', 'inherit')
:css('color', 'var(--color-base-fixed);')
:css('text-align','left')
:css('text-align','left')
:wikitext(nation)
:wikitext(nation)
Line 315: Line 315:
:attr('colspan', colspan)
:attr('colspan', colspan)
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_gold']) or totalGold))
:wikitext(lang:formatNum(args['total_gold'] or totalGold))
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_silver']) or totalSilver))
:wikitext(lang:formatNum(args['total_silver'] or totalSilver))
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_bronze']) or totalBronze))
:wikitext(lang:formatNum(args['total_bronze'] or totalBronze))
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['grand_total']) or (totalGold + totalSilver + totalBronze)))
:wikitext(lang:formatNum(args['grand_total'] or totalGold + totalSilver + totalBronze))
:css('font-weight', 'bold')
:css('font-weight', 'bold')
end
end