Module:Tour history

local p = {}

-- NOT CURRENTLY USED, CAN PROBABLY BE REMOVED function p._list( artist, tour, year, noposter ) local cargo = mw.ext.cargo

select_clause = "CONCAT(, shows.date, )=Date, " .. "shows.venue=Venue, shows.location=Location, " .. "IF(live_songs.name IS NULL, , )=Setlist, " .. "IF(live_show_photos._pageName IS NULL AND shows.poster IS NULL, , )=Photos, " .. "IF(live_banter._pageName IS NULL, , )=Banter"

if noposter ~= '' and noposter ~= nil then select_clause = 'CONCAT("")=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

function p._is_tour_page(title) return string.sub(title, -12) == 'tour history' or string.sub(title, -9) == 'residency' or string.sub(title, -5) == ' tour' end

function p.is_tour_page(frame) local title = frame.args[1] or frame:getTitle return p._is_tour_page(frame) end

return p