Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/api_cod/subs/missing_exists.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function exists_by_qids_query($endpoint_params)
/*
[
{ "name": "lang", "column": "t.code", "type": "text", "placeholder": "Language code", "no_mt_options": true },
{ "name": "category", "column": "aa.category", "type": "text", "placeholder": "Category", "no_mt_options": true },
{ "name": "category", "column": "cm.category", "type": "text", "placeholder": "Category", "no_mt_options": true },
{ "name": "campaign", "column": "campaign", "type": "text", "placeholder": "Campaign" },
{ "name": "order", "column": "order", "type": "text", "placeholder": "Order by", "no_select": true }
]
Expand All @@ -28,12 +28,12 @@ function exists_by_qids_query($endpoint_params)
SELECT
t.qid AS qid,
q.title AS title,
aa.category AS category,
cm.category AS category,
t.code AS code,
t.target AS target
FROM qids q
JOIN all_qids_exists t ON t.qid = q.qid
LEFT JOIN all_articles aa ON aa.article_id = q.title
JOIN all_qids_exists t ON t.qid = q.qid
LEFT JOIN category_members cm ON cm.article_id = q.title
Comment thread
MrIbrahem marked this conversation as resolved.
WHERE t.code = ?

AND (t.target != '' AND t.target IS NOT NULL)
Expand All @@ -56,10 +56,10 @@ function exists_by_qids_query($endpoint_params)
$category = sanitize_input($category_raw ?? '', '/^[A-Za-z0-9-]+$/');
// ---
if ($category === null && $campaign !== null) {
$qua .= " AND aa.category IN (SELECT category FROM categories WHERE campaign = ?)";
$qua .= " AND cm.category IN (SELECT category FROM categories WHERE campaign = ?)";
$params[] = $campaign;
} elseif ($category !== null) {
$qua .= " AND aa.category = ?";
$qua .= " AND cm.category = ?";
$params[] = $category;
}
// ---
Expand Down