Module:Video game wikidata: Difference between revisions

Content deleted Content added
Undid revision 745657883 by Ferret (talk)
Empty P444 with no qualifiers fixed.
Line 466:
local reviewsToPrint = {}
for i,review in pairs(reviewscores) do
local scoreByif(review['qualifiers'] ~= nil) then
local scoreBy = nil
if(review['qualifiers']['P447'] ~= nil and review['qualifiers']['P447'][1] ~= nil) then
scoreBy = review['qualifiers']['P447'][1]['datavalue']['value']['numeric-id'];
end;
if(scoreBy == reviewer) then
-- If template specified a system, we need to check for the specific system and only output that one.
if(system == nil or system == "") then
-- No system specified, so output each one found.
table.insert(reviewsToPrint,review);
else
-- Get platform if it exists.
if(review['qualifiers']['P400'] ~= nil and review['qualifiers']['P400'][1] ~= nil) then
-- Try to match based on QID.
local reviewSysId = review['qualifiers']['P400'][1]['datavalue']['value']['numeric-id'];
if(systemId == reviewSysId) then
table.insert(reviewsToPrint,review);
else
-- If that failed, try to match based on label.
local systemName = mw.wikibase.label('Q'..reviewSysId);
if(systemName ~= nil and string.upper(systemName) == system) then
table.insert(reviewsToPrint,review);
else
-- If that failed, try to match based on label.
local systemName = mw.wikibase.label('Q'..reviewSysId);
if(systemName ~= nil and string.upper(systemName) == system) then
table.insert(reviewsToPrint,review);
end;
end;
end;