fix tags/places filters
This commit is contained in:
@@ -504,12 +504,20 @@ const eventController = {
|
|||||||
where.start_datetime = { [Op.lte]: end }
|
where.start_datetime = { [Op.lte]: end }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (places || tags) {
|
if (tags && places) {
|
||||||
where[Op.or] = {
|
where[Op.or] = {
|
||||||
placeId: places ? places.split(',') : [],
|
placeId: places ? places.split(',') : [],
|
||||||
'$tags.tag$': tags ? tags.split(',') : []
|
'$tags.tag$': tags.split(',')
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tags) {
|
||||||
|
where['$tags.tag$'] = tags.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (places) {
|
||||||
|
where.placeId = places.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
const events = await Event.findAll({
|
const events = await Event.findAll({
|
||||||
where,
|
where,
|
||||||
|
|||||||
@@ -17,12 +17,22 @@ const exportController = {
|
|||||||
const where = {}
|
const where = {}
|
||||||
const yesterday = moment().subtract('1', 'day').unix()
|
const yesterday = moment().subtract('1', 'day').unix()
|
||||||
|
|
||||||
if (places || tags) {
|
|
||||||
|
if (tags && places) {
|
||||||
where[Op.or] = {
|
where[Op.or] = {
|
||||||
placeId: places ? places.split(',') : [],
|
placeId: places ? places.split(',') : [],
|
||||||
'$tags.tag$': tags ? tags.split(',') : []
|
'$tags.tag$': tags.split(',')
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tags) {
|
||||||
|
where['$tags.tag$'] = tags.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (places) {
|
||||||
|
where.placeId = places.split(',')
|
||||||
|
}
|
||||||
|
|
||||||
if (!show_recurrent) {
|
if (!show_recurrent) {
|
||||||
where.parentId = null
|
where.parentId = null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user