<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://staging.twogpedia.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AGameLanding%2FTournaments</id>
	<title>Module:GameLanding/Tournaments - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://staging.twogpedia.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AGameLanding%2FTournaments"/>
	<link rel="alternate" type="text/html" href="https://staging.twogpedia.com/index.php?title=Module:GameLanding/Tournaments&amp;action=history"/>
	<updated>2026-09-26T07:42:00Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://staging.twogpedia.com/index.php?title=Module:GameLanding/Tournaments&amp;diff=6227&amp;oldid=prev</id>
		<title>Couchor: Created page with &quot;local cargo = mw.ext.cargo local p = {} local prizeToString = require(&#039;Module:Functions&#039;).prizeToString  function p.tournaments(game) 	local tables = &#039;Tournaments&#039; 	local fields = &#039;_pageName, start, end, prize, logoAll, logoLight, logoDark, iconAll, iconLight, iconDark, venue&#039; 	local currentDate = os.date(&#039;%Y-%m-%d&#039;) 	local cargoArgs = { 		where = &#039;featured IS NULL AND _pageName LIKE &quot;&#039; .. game .. &#039;/%&quot; AND ( (start is NULL OR start &lt; &quot;&#039; .. currentDate .. &#039;&quot;) AND (end is...&quot;</title>
		<link rel="alternate" type="text/html" href="https://staging.twogpedia.com/index.php?title=Module:GameLanding/Tournaments&amp;diff=6227&amp;oldid=prev"/>
		<updated>2023-09-29T11:32:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;local cargo = mw.ext.cargo local p = {} local prizeToString = require(&amp;#039;Module:Functions&amp;#039;).prizeToString  function p.tournaments(game) 	local tables = &amp;#039;Tournaments&amp;#039; 	local fields = &amp;#039;_pageName, start, end, prize, logoAll, logoLight, logoDark, iconAll, iconLight, iconDark, venue&amp;#039; 	local currentDate = os.date(&amp;#039;%Y-%m-%d&amp;#039;) 	local cargoArgs = { 		where = &amp;#039;featured IS NULL AND _pageName LIKE &amp;quot;&amp;#039; .. game .. &amp;#039;/%&amp;quot; AND ( (start is NULL OR start &amp;lt; &amp;quot;&amp;#039; .. currentDate .. &amp;#039;&amp;quot;) AND (end is...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local cargo = mw.ext.cargo&lt;br /&gt;
local p = {}&lt;br /&gt;
local prizeToString = require(&amp;#039;Module:Functions&amp;#039;).prizeToString&lt;br /&gt;
&lt;br /&gt;
function p.tournaments(game)&lt;br /&gt;
	local tables = &amp;#039;Tournaments&amp;#039;&lt;br /&gt;
	local fields = &amp;#039;_pageName, start, end, prize, logoAll, logoLight, logoDark, iconAll, iconLight, iconDark, venue&amp;#039;&lt;br /&gt;
	local currentDate = os.date(&amp;#039;%Y-%m-%d&amp;#039;)&lt;br /&gt;
	local cargoArgs = {&lt;br /&gt;
		where = &amp;#039;featured IS NULL AND _pageName LIKE &amp;quot;&amp;#039; .. game .. &amp;#039;/%&amp;quot; AND ( (start is NULL OR start &amp;lt; &amp;quot;&amp;#039; .. currentDate .. &amp;#039;&amp;quot;) AND (end is NULL OR end &amp;gt; &amp;quot;&amp;#039; .. currentDate .. &amp;#039;&amp;quot;) OR start &amp;gt; &amp;#039; .. currentDate .. &amp;#039; )&amp;#039;,&lt;br /&gt;
		limit = 10&lt;br /&gt;
	}&lt;br /&gt;
	local results = cargo.query(tables, fields, cargoArgs)&lt;br /&gt;
&lt;br /&gt;
	if #results &amp;gt; 0 then&lt;br /&gt;
		local monthNames = {&amp;quot;Jan&amp;quot;, &amp;quot;Feb&amp;quot;, &amp;quot;Mar&amp;quot;, &amp;quot;Apr&amp;quot;, &amp;quot;May&amp;quot;, &amp;quot;Jun&amp;quot;, &amp;quot;Jul&amp;quot;, &amp;quot;Aug&amp;quot;, &amp;quot;Sep&amp;quot;, &amp;quot;Oct&amp;quot;, &amp;quot;Nov&amp;quot;, &amp;quot;Dec&amp;quot;}&lt;br /&gt;
		local headerRow = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tournament__header tournament__row&amp;#039;):node(mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;Date&amp;#039;)):node(mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;Prize&amp;#039;)):node(mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;Name&amp;#039;))&lt;br /&gt;
		local tournaments = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tournament__container&amp;#039;):node(headerRow)&lt;br /&gt;
		local tournamentContainer = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;box__container&amp;#039;):node(mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;box__title&amp;#039;):wikitext(&amp;#039;Tournaments&amp;#039;)):node(tournaments)&lt;br /&gt;
&lt;br /&gt;
		for i = 1, #results do&lt;br /&gt;
			local result = results[i]&lt;br /&gt;
	&lt;br /&gt;
			local tournamentRow = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tournament__row&amp;#039;)&lt;br /&gt;
			&lt;br /&gt;
			local currentTime = os.time()&lt;br /&gt;
			&lt;br /&gt;
			local startTime = nil&lt;br /&gt;
			if result.start then&lt;br /&gt;
				startTime = mw.ustring.gsub(result.start, &amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;, function(year, month, day)&lt;br /&gt;
				    return os.time({year=tonumber(year), month=tonumber(month), day=tonumber(day)})&lt;br /&gt;
				end)	&lt;br /&gt;
			end&lt;br /&gt;
			local endTime = nil&lt;br /&gt;
			if result[&amp;#039;end&amp;#039;] then&lt;br /&gt;
				endTime = mw.ustring.gsub(result[&amp;#039;end&amp;#039;], &amp;#039;(%d+)-(%d+)-(%d+)&amp;#039;, function(year, month, day)&lt;br /&gt;
				    return os.time({year=tonumber(year), month=tonumber(month), day=tonumber(day)})&lt;br /&gt;
				end)&lt;br /&gt;
			end&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
			local date = mw.html.create(&amp;#039;div&amp;#039;)&lt;br /&gt;
			-- If live&lt;br /&gt;
			if (startTime ~= nil and os.difftime(currentTime, startTime) &amp;gt; 0) and (endTime == nil or os.difftime(currentTime, endTime) &amp;lt;= 0) then&lt;br /&gt;
				date:wikitext(&amp;#039;LIVE&amp;#039;)&lt;br /&gt;
			else &lt;br /&gt;
				local startDate = &amp;#039;TBD&amp;#039;&lt;br /&gt;
				if result.start then&lt;br /&gt;
					local year, month, day = result.start:match(&amp;quot;(%d+)-(%d+)-(%d+)&amp;quot;)&lt;br /&gt;
					local monthName = monthNames[tonumber(month)]&lt;br /&gt;
					startDate = monthName .. &amp;quot; &amp;quot; .. day .. &amp;quot;, &amp;quot; .. year&lt;br /&gt;
				end&lt;br /&gt;
				local endDate = &amp;#039;TBD&amp;#039;&lt;br /&gt;
				if result[&amp;#039;end&amp;#039;] then&lt;br /&gt;
					year, month, day = result[&amp;#039;end&amp;#039;]:match(&amp;quot;(%d+)-(%d+)-(%d+)&amp;quot;)&lt;br /&gt;
					monthName = monthNames[tonumber(month)]&lt;br /&gt;
					endDate = monthName .. &amp;quot; &amp;quot; .. day .. &amp;quot;, &amp;quot; .. year&lt;br /&gt;
				end&lt;br /&gt;
				date:wikitext(startDate .. &amp;#039; - &amp;#039; .. endDate)&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local prize = mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;$&amp;#039; .. prizeToString(result.prize))&lt;br /&gt;
			&lt;br /&gt;
			local icon = result.iconAll ~= &amp;#039;&amp;#039; and result.iconAll or result.iconLight ~= &amp;#039;&amp;#039; and result.iconLight or result.iconDark ~= &amp;#039;&amp;#039; and result.iconDark or result.logoAll ~= &amp;#039;&amp;#039; and result.logoAll or result.logoDark ~= &amp;#039;&amp;#039; and result.logoDark or result.logoLight ~= &amp;#039;&amp;#039; and result.logoLight&lt;br /&gt;
			if not icon then icon = &amp;#039;Tournament_placeholder.png&amp;#039; end&lt;br /&gt;
			local name = mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tournament__name&amp;#039;):node(mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;[[File:&amp;#039; .. icon .. &amp;#039;|25px]]&amp;#039;)):node(mw.html.create(&amp;#039;div&amp;#039;):wikitext(&amp;#039;[[&amp;#039; .. result._pageName .. &amp;#039;]]&amp;#039;))&lt;br /&gt;
			-- featuredTournament:node(mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tc&amp;#039;):wikitext(&amp;#039;[[File:&amp;#039; .. icon .. &amp;#039;|200px]]&amp;#039;))&lt;br /&gt;
			-- featuredTournament:node(mw.html.create(&amp;#039;div&amp;#039;):addClass(&amp;#039;tc&amp;#039;):wikitext(&amp;#039;[[&amp;#039; .. result._pageName .. &amp;#039;]]&amp;#039;))&lt;br /&gt;
			&lt;br /&gt;
			tournaments:node(tournamentRow:node(date):node(prize):node(name))&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return tournamentContainer&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Couchor</name></author>
	</entry>
</feed>