Module:Video game reviews/sandbox: Difference between revisions

Content deleted Content added
make that a class instead
extract the rendermainheading function, move aggregators above reviewers in supermode table, remove dependency on reviewercount in aggregators in prep to extract to its own table
Line 89:
 
local function renderHeadingRowWithSystems(builder, mainHeading, activeSystems)
renderMainHeading(builder, #activeSystems + 1, mainHeading)
builder:tag('tr')
:addClass('vgr-systems')
:tag('th')
:attr('rowspan', '2')
:attr('scope', 'col')
:attr('rowspan', '2')
:wikitext(data.i18n.publication)
:done()
:tag('th')
:attr('scope', #activeSystems == 1 and 'col' or 'colgroup')
:attr('colspan', #activeSystems)
:attr('scope', #activeSystems == 1 and 'col' or 'colgroup')
:wikitext(data.i18n.score)
:done()
Line 111 ⟶ 110:
end
 
local function renderHeadingRow(builder, mainHeading, nameHeading)
renderMainHeading(builder, 2, mainHeading)
builder:tag('tr')
:addClass('vgr-hrow')
:tag('th')
:wikitext(nameHeading)
:attr('scope', 'col')
:wikitext(nameHeading)
:done()
:tag('th')
:wikitext(data.i18n.score)
:attr('scope', 'col')
:wikitext(data.i18n.score)
:done()
end
Line 171 ⟶ 169:
local na = yesno(args.na)
local showplatforms = #activeSystems ~= 1 or yesno(args.showplatforms)
if reviewerCountaggregatorCount ~= 0 then
if showplatforms then
renderHeadingRowWithSystemsrenderMainHeading(builder, reviewScore#activeSystems + 1, activeSystemsaggregateScore)
renderHeadingRowWithSystems(builder, aggregateScore, activeSystems)
else
renderHeadingRowrenderMainHeading(builder, reviewScore2, data.i18n.publicationaggregateScore)
renderHeadingRow(builder, data.i18n.aggregator)
end
 
for _, v in ipairs(providedReviewersprovidedAggregators) do
renderRatingsBySystem(builder, v, data.reviewersaggregators[v].name, activeSystems, args, na)
end
for _, v in ipairs(customReviewerKeyscustomAggregatorKeys) do
renderRatingsBySystem(builder, v, args[v], activeSystems, args, na)
end
end
if aggregatorCountreviewerCount ~= 0 then
if reviewerCount ~= 0showplatforms then
renderMainHeading(builder, #activeSystems + 1, aggregateScorereviewScore)
renderHeadingRowWithSystems(builder, activeSystems)
elseif showplatforms then
renderHeadingRowWithSystems(builder, aggregateScore, activeSystems)
else
renderHeadingRowrenderMainHeading(builder, aggregateScore2, data.i18n.aggregatorreviewScore)
:wikitext renderHeadingRow(builder, data.i18n.publication)
end
 
for _, v in ipairs(providedAggregatorsprovidedReviewers) do
renderRatingsBySystem(builder, v, data.aggregatorsreviewers[v].name, activeSystems, args, na)
end
for _, v in ipairs(customAggregatorKeyscustomReviewerKeys) do
renderRatingsBySystem(builder, v, args[v], activeSystems, args, na)
end
Line 204:
builder:wikitext(data.i18n.singleplatformCategory)
if aggregatorCount ~= 0 then
renderHeadingRowrenderMainHeading(builder, aggregateScore2, data.i18n.aggregatoraggregateScore)
renderHeadingRow(builder, data.i18n.aggregator)
for _, v in ipairs(providedAggregators) do
renderRating(builder, data.aggregators[v].name, args[v])
Line 213 ⟶ 214:
end
if reviewerCount ~= 0 then
renderHeadingRowrenderMainHeading(builder, reviewScore2, data.i18n.publicationreviewScore)
renderHeadingRow(builder, data.i18n.publication)
for _, v in ipairs(providedReviewers) do
renderRating(builder, data.reviewers[v].name, args[v])
Line 235 ⟶ 237:
builder:tag('tr')
:tag('th')
:wikitext(data.i18n.publication)
:attr('scope', 'col')
:wikitext(data.i18n.awardpublication)
:done()
:tag('th')
:wikitext(data.i18n.award)
:attr('scope', 'col')
:wikitext(data.i18n.award)
:done()