Module:Tour stats: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 248: Line 248:
"IF(live_show_videos._pageName IS NULL, NULL, '1')=video",
"IF(live_show_videos._pageName IS NULL, NULL, '1')=video",
}
}
if options['group_by'] == 'song' then
table.insert(fields, "live_songs.name=song")
table.insert(fields, "live_songs.acoustic=acoustic")
table.insert(fields, "live_songs.piano=piano")
table.insert(fields, "live_songs.tease=tease")
table.insert(fields, "live_songs.abandoned=abandoned")
table.insert(fields, "live_songs.length=length")
table.insert(fields, "live_songs.vip=vip")
table.insert(fields, "live_songs.soundcheck=soundcheck")
end
local wheres = {}
local wheres = {}
local joins = {
local joins = {
Line 264: Line 254:
['live_show_photos._pageName'] = 'live_show_videos._pageName'
['live_show_photos._pageName'] = 'live_show_videos._pageName'
}
}
local groups = {'shows._pageName'}


-- live_songs options
-- live_songs options
local multiSong = false
if options['songs'] then
if options['songs'] then
local songs = mw.text.split(options['songs'], ';', true)
local songs = mw.text.split(options['songs'], ';', true)
multiSong = #songs > 1
local songWheres = {}
local songWheres = {}
for r = 1, #songs do
for r = 1, #songs do
Line 273: Line 266:
end
end
table.insert(wheres, "(" .. table.concat(songWheres, ' OR ') .. ")")
table.insert(wheres, "(" .. table.concat(songWheres, ' OR ') .. ")")
end
if options['show_songs'] or multiSong then
table.insert(groups, "live_songs._ID")
table.insert(fields, "live_songs.name=song")
table.insert(fields, "live_songs.acoustic=acoustic")
table.insert(fields, "live_songs.piano=piano")
table.insert(fields, "live_songs.tease=tease")
table.insert(fields, "live_songs.abandoned=abandoned")
table.insert(fields, "live_songs.length=length")
table.insert(fields, "live_songs.vip=vip")
table.insert(fields, "live_songs.soundcheck=soundcheck")
end
end
if options['acoustic'] and options['acoustic'] ~= 'No' then
if options['acoustic'] and options['acoustic'] ~= 'No' then
Line 338: Line 342:


local offset = options['offset'] or 0
local offset = options['offset'] or 0
local results = cargo.query(
local results = cargo.query(
table.concat(tables, ','),
table.concat(tables, ','),
Line 344: Line 349:
where = table.concat(wheres, ' AND '),
where = table.concat(wheres, ' AND '),
join = table.concat(joins2, ','),
join = table.concat(joins2, ','),
offset = offset
offset = offset,
groupBy = table.concat(groups, ',')
}
}
)
)
Line 375: Line 381:
date_before = false,
date_before = false,
offset = false,
offset = false,
group_by = false,
show_songs = false,
}
}