Module:Video game reviews/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
combine the reviewer and aggregator loops
Jackmcbarn (talk | contribs)
better variable names
Line 68:
end
 
local function reviews(halfkeysrevprovidedReviewers, halfkeysaggprovidedAggregators, platforms, custome_agg, custome_rev, args)
local arg_system
local tbl2
if (#halfkeysrevprovidedReviewers > 0 or #halfkeysaggprovidedAggregators > 0) and platforms >= 1 then
tbl2 = HtmlBuilder.create('table')
.addClass('infobox wikitable')
Line 80:
.css('margin', '0em')
.done()
elseif (#halfkeysrevprovidedReviewers > 0 or #halfkeysaggprovidedAggregators > 0 or custome_agg > 0 or custome_rev > 0) and platforms == 0 then
tbl2 = HtmlBuilder.create('table')
.addClass('infobox wikitable')
Line 91:
.done()
end
if #halfkeysrevprovidedReviewers > 0 and (platforms > 1 or string.lower(tostring(args['showplatforms'])) == 'true') then
tbl2.tag('tr').tag('th')
.attr('colspan', #system + 1)
Line 118:
end
end
elseif #halfkeysrevprovidedReviewers > 0 and platforms == 1 and string.lower(tostring(args['showplatforms'])) ~= 'true' then
tbl2.tag('tr').tag('th')
.attr('colspan', '2')
Line 140:
if platforms >= 1 then
for i = 1, #reviewer do
for k = 1, #halfkeysrevprovidedReviewers do
if reviewer[i][2] == halfkeysrevprovidedReviewers[k] then
local forloop = tbl2.tag('tr')
forloop.tag('td')
Line 190:
end
end
if (#halfkeysaggprovidedAggregators > 0 and platforms > 1) and #halfkeysrevprovidedReviewers == 0 then
tbl2
.tag('tr')
Line 218:
end
end
elseif (#halfkeysaggprovidedAggregators > 0 and #halfkeysrevprovidedReviewers > 0) or (#halfkeysaggprovidedAggregators > 0 and platforms == 1)then
tbl2
.tag('tr')
Line 228:
end
for i = 1, #aggregator do
for k = 1, #halfkeysaggprovidedAggregators do
if aggregator[i][2] == halfkeysaggprovidedAggregators[k] then
local forloop = tbl2.tag('tr')
forloop.tag('td')
Line 254:
end
elseif platforms == 0 then
if #halfkeysaggprovidedAggregators > 0 or custome_agg > 0 then
tbl2
.tag('tr')
Line 274:
end
for i = 1, #aggregator do
for k = 1, #halfkeysaggprovidedAggregators do
if aggregator[i][2] == halfkeysaggprovidedAggregators[k] then
tbl2
.tag('tr')
Line 305:
end
end
if #halfkeysrevprovidedReviewers > 0 or custome_rev > 0 then
tbl2.tag('tr').tag('th')
.attr('colspan', #system + 1)
Line 324:
 
for i = 1, #reviewer do
for k = 1, #halfkeysrevprovidedReviewers do
if reviewer[i][2] == halfkeysrevprovidedReviewers[k] then
tbl2
.tag('tr')
Line 402:
end
 
local function renderMainTable(halfkeysrevprovidedReviewers, halfkeysaggprovidedAggregators, awardKeys, platforms, custome_agg, custome_rev, args)
local tbl
 
if args['award1'] or ((#halfkeysaggprovidedAggregators > 0 or #halfkeysrevprovidedReviewers > 0 or custome_agg > 0 or custome_rev > 0) and platforms >= 0) then
if platforms == 0 then
-- Width: 20% Seems better since it scales with the article size.
Line 462:
.tag('tr')
.tag('td')
.node(reviews(halfkeysrevprovidedReviewers, halfkeysaggprovidedAggregators, platforms, custome_agg, custome_rev, args))
 
tbl
Line 480:
 
function p._reviewbox(args)
local halfkeysrevprovidedReviewers, halfkeysaggprovidedAggregators = {}, {}
local sortedArgKeys = {}
Line 504:
seen[halfarg] = true
if data.reviewers[halfarg] then
table.insert(halfkeysrevprovidedReviewers, halfarg)
elseif data.aggregators[halfarg] then
table.insert(halfkeysaggprovidedAggregators, halfarg)
end
end
Line 515:
if not argKey:find('_') then
if data.reviewers[argKey] then
table.insert(halfkeysrevprovidedReviewers, argKey)
elseif data.aggregators[argKey] then
table.insert(halfkeysaggprovidedAggregators, argKey)
end
end
end
end
return renderMainTable(halfkeysrevprovidedReviewers, halfkeysaggprovidedAggregators, awardKeys, platforms, custome_agg, custome_rev, args)
end