Jump to content

Module:Grand Slam Track

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Habst (talk | contribs) at 14:57, 2 April 2025 (add gst module). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
p = {}

local P_POINTINTIME = 'P585'
local P_PARTICIPANTOF = 'P1344'
local P_SPORTSDISCIPLINE = 'P2416'
local P_COMPETITIONCLASS = 'P2094'
local P_RANK = 'P1352'
local P_RACETIME = 'P2781'

local Q_KINGSTON25 = 'Q133804597'

local marks = { P_RACETIME }

p.athleticsResults = function(frame)
	local qid = frame.args[1]
	local ent = mw.wikibase.getEntity(qid)
	local participantOfClaims = ent['claims'][P_PARTICIPANTOF]
	local years = {}
	local output = ''
	output = output .. '{| class="wikitable mw-collapsible" border="1" style="border-collapse: collapse; width: 100%; font-size: 90%;"\n'
	output = output .. '!colspan=5| Grand Slam Track results for Usain Bolt\n'
	output = output .. '|-\n'
	output = output .. '!scope="col" style="width:5%;"| Slam !!scope="col" style="width:20%;"| Race group !!scope="col" style="width:10%;"| Evt. !!scope="col" style="width:10%;"| Pl. !!scope="col" style="width:5%;"| Time\n'
	for i, pc in ipairs(participantOfClaims) do
		mw.logObject(mw.wikibase.renderSnak(pc['mainsnak']))
		if pc['qualifiers'] then
            output = output .. '|-\n'
            output = output .. '| '

            serialized = serialized .. mw.wikibase.renderSnak(pc['mainsnak']) .. ' || ' -- Slam
            serialized = serialized .. mw.wikibase.renderSnak(pc['qualifiers'][P_COMPETITIONCLASS][1]) .. ' || ' -- Race group
            serialized = serialized .. mw.wikibase.renderSnak(pc['qualifiers'][P_SPORTSDISCIPLINE][1]) .. ' || ' -- Evt.
            serialized = serialized .. mw.wikibase.renderSnak(pc['qualifiers'][P_RANK][1]) .. ' || ' -- Pl.
            serialized = serialized .. mw.wikibase.renderSnak(pc['qualifiers'][P_RACETIME][1]) .. '\n' -- Time
		end
	end
	output = output .. '|}\n'
	return output
end
return p