Module:Video game wikidata: Difference between revisions

Content deleted Content added
Fix for when a P444 is set with no qualifiers.
Undid revision 745657883 by Ferret (talk)
Line 466:
local reviewsToPrint = {}
for i,review in pairs(reviewscores) do
local scoreBy = nil
if(review['qualifiers']['P447'] ~= nil and #review['qualifiers']['P447'][1] >~= 0nil) then
scoreBy = review['qualifiers']['P447'][1]['datavalue']['value']['numeric-id'];
local scoreBy = nil
end;
if(review['qualifiers']['P447'] ~= nil and review['qualifiers']['P447'][1] ~= nil) then
if(systemIdscoreBy == reviewSysIdreviewer) then
scoreBy = review['qualifiers']['P447'][1]['datavalue']['value']['numeric-id'];
-- If template specified a system, we need to check for the specific system and only output that one.
end;
if(scoreBysystem == reviewernil or system == "") then
-- IfNo templatesystem specified a system, we need to check for the specific system and onlyso output thateach one found.
table.insert(reviewsToPrint,review);
if(system == nil or system == "") then
else
-- No system specified, so output each one found.
-- Get platform if it exists.
table.insert(reviewsToPrint,review);
if(review['qualifiers']['P447P400'] ~= nil and review['qualifiers']['P447P400'][1] ~= nil) then
else
-- GetTry platformto ifmatch itbased existson QID.
if(local reviewSysId = review['qualifiers']['P400'] ~= nil and review[1]['qualifiersdatavalue']['P400value'][1'numeric-id'] ~= nil) then;
if(systemId == reviewSysId) then
-- Try to match based on QID.
table.insert(reviewsToPrint,review);
local reviewSysId = review['qualifiers']['P400'][1]['datavalue']['value']['numeric-id'];
else
if(systemId == reviewSysId) then
-- TryIf that failed, try to match based on QIDlabel.
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;