Module:University of Toronto Mississauga

MyWikiBiz, Author Your Legacy — Thursday November 28, 2024
Jump to navigationJump to search

Documentation for this module may be created at Module:University of Toronto Mississauga/doc

local p = {}

-- #statements don't support selecting based on a qualifier, so this is needed.
local entity = mw.wikibase.getEntity("Q6120110")
for _, statement in pairs(entity:getBestStatements("students count")) do
	if statement["qualifiers"]["P518"] == nil then
		p._studentCount = tonumber(statement["mainsnak"]["datavalue"]["value"]["amount"])
	elseif statement["qualifiers"]["P518"][1]["datavalue"]["value"]["id"] == "Q21094885" then
		p._undergradCount = tonumber(statement["mainsnak"]["datavalue"]["value"]["amount"])
	elseif statement["qualifiers"]["P518"][1]["datavalue"]["value"]["id"] == "Q18245166" then
		p._gradCount = tonumber(statement["mainsnak"]["datavalue"]["value"]["amount"])
	end
end

function p.studentCount()
	return p._studentCount
end

function p.undergradCount()
	return p._undergradCount
end

function p.gradCount()
	return p._gradCount
end

return p