Module:TeamResultsAbstract

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_esports = require('Module:EsportsUtil') local util_html = require('Module:HtmlUtil') local util_map = require('Module:MapUtil') local util_table = require('Module:TableUtil') local util_text = require('Module:TextUtil') local util_toggle = require('Module:ToggleUtil') local util_tournament = require('Module:TournamentUtil') local util_vars = require('Module:VarsUtil') local i18n = require('Module:i18nUtil') local m_team = require('Module:Team') local lang = mw.getLanguage('en')

local Results = require('Module:TournamentResultsQueryAbstract'):extends

function Results:makeHeaderText(team) local text = mw.html.create text:wikitext(i18n.print('tResults',m_team.teamname(team))) :wikitext(' (')	util_toggle.printOptionFromListTogglers(text, self.CURRENCY_TOGGLE)	text:wikitext(')') return tostring(text) end

function Results:finalizeTable(tbl, result, subject) local td = tbl:tag("tr") :tag("th"):attr("colspan",#self.COLUMNS) :wikitext(i18n.print('totalPrize')) :wikitext(self:getTotalEarnings(result)) end

function Results:getTotalEarnings(result) local earnings = {} for _, row in ipairs(result) do		if row.PrizeUnit then util_vars.log(row.Prize) earnings[row.PrizeUnit] = (earnings[row.PrizeUnit] or 0) + (tonumber(row.Prize,10) or 0) end end local earningstable = {} for currency, amount in pairs(earnings) do earningstable[#earningstable+1] = currency .. " " .. lang:formatNum(amount) end return util_table.concat(earningstable," &#8226; ") end

return Results