forked from server/soundboard
Fix SQL query for tag filtering
This commit is contained in:
parent
b0df58c925
commit
8765fbb360
@ -170,10 +170,10 @@ WHERE button.id IN (
|
|||||||
GROUP BY button_tags.fk_button
|
GROUP BY button_tags.fk_button
|
||||||
HAVING
|
HAVING
|
||||||
"""
|
"""
|
||||||
tagFilter = "\t\tSUM(CASE WHEN tag.name = \"{}\" THEN 1 ELSE 0 END) > 0"
|
tagFilter = "\t\tSUM(CASE WHEN tag.name = ? THEN 1 ELSE 0 END) > 0"
|
||||||
tagFilters = " AND \n".join([tagFilter.format(tag) for tag in tags.split(",")])
|
tagFilters = " AND \n".join([tagFilter.format(tag) for tag in tags.split(",")])
|
||||||
query += tagFilters + "\n)"
|
query += tagFilters + "\n)"
|
||||||
|
|
||||||
sounds = queryDB(query)
|
sounds = queryDB(query, tags.split(","))
|
||||||
|
|
||||||
return jsonify([sound["file"].split(".")[0] for sound in sounds])
|
return jsonify([sound["file"].split(".")[0] for sound in sounds])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user