66 506
contributi
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
(10 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 58: | Riga 58: | ||
function p.SeasonsQty(ShortName) | function p.SeasonsQty(ShortName) | ||
local QueryResult | local QueryResult | ||
local Max | local Max = 0 | ||
local PrefixText | local PrefixText | ||
Riga 72: | Riga 72: | ||
-- See https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/mw.smw.ask.md#result | -- See https://github.com/SemanticMediaWiki/SemanticScribunto/blob/master/docs/mw.smw.ask.md#result | ||
-- for return value example | -- for return value example | ||
if QueryResult == nil or Max < 0 then | if QueryResult == nil or Max < 0 then | ||
return 0 | return 0 | ||
else | else | ||
Max = QueryResult[1]["Stagione"] | |||
return Max | return Max | ||
end | end | ||
Riga 102: | Riga 102: | ||
Series = mw.wikibase.getLabel(Item.claims['P16'][1].mainsnak.datavalue.value.id) | Series = mw.wikibase.getLabel(Item.claims['P16'][1].mainsnak.datavalue.value.id) | ||
if | if SeriesShort == "Serie Classica" or SeriesShort == "Serie Animata" then | ||
CategoryText = '[[Category:Personaggi della ' .. SeriesShort .. "]]" | CategoryText = '[[Category:Personaggi della ' .. SeriesShort .. "]]" | ||
else | else | ||
Riga 148: | Riga 148: | ||
Series = mw.wikibase.getLabel(Item.claims['P16'][1].mainsnak.datavalue.value.id) | Series = mw.wikibase.getLabel(Item.claims['P16'][1].mainsnak.datavalue.value.id) | ||
if | if SeriesShort == "Serie Classica" or SeriesShort == "Serie Originale" or SeriesShort == "Serie Animata" then | ||
InstanceText = '[[Istanza::Episodio della ' .. SeriesShort .. "]]" | InstanceText = '[[Istanza::Episodio della ' .. SeriesShort .. "]]" | ||
else | else | ||
InstanceText = '[[Istanza::Episodio di ' .. SeriesShort .. "]]" | InstanceText = '[[Istanza::Episodio di ' .. SeriesShort .. "]]" | ||
end | end | ||
--[==[ | |||
Pages = mw.smw.ask(InstanceText .. "|?Personaggio|order=asc|sort=Numero di produzione") | Pages = mw.smw.ask(InstanceText .. "|?Personaggio|order=asc|sort=Numero di produzione") | ||
if Pages == nil then | if Pages == nil then | ||
return "''Nessun risultato'' (<code>" .. mw.text.nowiki(InstanceText) .. "</code>)" | return "''Nessun risultato'' (<code>" .. mw.text.nowiki(InstanceText) .. "</code>, )" | ||
else | else | ||
--local myResult = "" | --local myResult = "" | ||
Riga 182: | Riga 182: | ||
end | end | ||
end | end | ||
]==] | |||
NewPages = mw.smw.getQueryResult(InstanceText .. "|?Personaggio |order=asc|sort=Numero di produzione") | NewPages = mw.smw.getQueryResult(InstanceText .. "|?Personaggio|limit=500|order=asc|sort=Numero di produzione") | ||
for _, Episode in ipairs(NewPages.results) do | for _, Episode in ipairs(NewPages.results) do | ||
Riga 233: | Riga 233: | ||
--Count = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page.fulltext .. ']]|format=count') | --Count = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page.fulltext .. ']]|format=count') | ||
--Episodes = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page.fulltext .. ']]|sort=Numero di produzione|order=asc') | --Episodes = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page.fulltext .. ']]|sort=Numero di produzione|order=asc') | ||
Episodes = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page .. ']]|sort=Numero di produzione|order=asc') | Episodes = mw.smw.ask('[[Serie::' .. Series .. ']][[Personaggio::' .. Page .. ']]|limit=100|sort=Numero di produzione|order=asc') | ||
if (Episodes ~= nil) and (#Episodes > MinOccurr - 1) then | if (Episodes ~= nil) and (#Episodes > MinOccurr - 1) then |