Module:Tour history

From SPCodex, The Smashing Pumpkins wiki
Revision as of 02:08, 29 September 2020 by MusikAnimal (talk | contribs) (Created page with "-- NOT CURRENTLY USED, CAN PROBABLY BE DELETED local p = {} local cargo = mw.ext.cargo function p._list( artist, tour, year, noposter ) select_clause = "CONCAT('[[', shows....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Tour history/doc

-- NOT CURRENTLY USED, CAN PROBABLY BE DELETED

local p = {}
local cargo = mw.ext.cargo

function p._list( artist, tour, year, noposter )
	select_clause = "CONCAT('[[', shows._pageName, '|', shows.date, ']]')=Date, " ..
		"shows.venue=Venue, shows.location=Location, " ..
		"IF(live_songs.name IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Setlist, " ..
		"IF(live_show_photos._pageName IS NULL AND shows.poster IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Photos, " ..
		"IF(live_banter._pageName IS NULL, '', '[[File:OOjs_UI_icon_check-constructive.svg|30px|link=]]')=Banter"

	if noposter ~= '' and noposter ~= nil then
		select_clause = 'CONCAT("[[File:", shows.poster, "|200px|link=", shows._pageName, "]]")=Poster, ' .. select_clause
	end

	where_conds = {}
	if artist and artist ~= '' then
		table.insert(where_conds, 'shows.artist = "' .. artist .. '"')
	end
	if tour and tour ~= '' then
		table.insert(where_conds, 'shows.tour = "' .. tour .. '"')
	end
	if year and year ~= '' then
		table.insert(where_conds, 'YEAR(shows.date) = ' .. year)
	end

	local results = cargo.query(
		'live_songs, shows, live_show_photos, live_banter',
		select_clause,
		{
			where = mw.text.listToText( where_conds, ' AND ' ),
			join = 'shows._pageName = live_songs._pageName, shows._pageName=live_show_photos._pageName, shows._pageName=live_banter._pageName',
			groupBy = 'shows._pageName',
			orderBy = 'shows.date ASC'
		}
	)

	mw.logObject(results)
end

return p