| 136 |
136 |
|
JOIN users u ON p.user_id = u.id
|
| 137 |
137 |
|
LEFT JOIN item_tags pit ON pit.item_id = i.id AND pit.is_primary = true
|
| 138 |
138 |
|
LEFT JOIN tags pt ON pt.id = pit.tag_id
|
| 139 |
|
- |
WHERE i.is_public = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
|
139 |
+ |
WHERE i.is_public = true AND i.listed = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
| 140 |
140 |
|
"#,
|
| 141 |
141 |
|
)
|
| 142 |
142 |
|
} else {
|
| 161 |
161 |
|
JOIN users u ON p.user_id = u.id
|
| 162 |
162 |
|
LEFT JOIN item_tags pit ON pit.item_id = i.id AND pit.is_primary = true
|
| 163 |
163 |
|
LEFT JOIN tags pt ON pt.id = pit.tag_id
|
| 164 |
|
- |
WHERE i.is_public = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
|
164 |
+ |
WHERE i.is_public = true AND i.listed = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
| 165 |
165 |
|
"#,
|
| 166 |
166 |
|
)
|
| 167 |
167 |
|
};
|
| 208 |
208 |
|
SELECT COUNT(*)
|
| 209 |
209 |
|
FROM items i
|
| 210 |
210 |
|
JOIN projects p ON i.project_id = p.id
|
| 211 |
|
- |
WHERE i.is_public = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
|
211 |
+ |
WHERE i.is_public = true AND i.listed = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
| 212 |
212 |
|
"#,
|
| 213 |
213 |
|
);
|
| 214 |
214 |
|
|
| 251 |
251 |
|
p.project_type,
|
| 252 |
252 |
|
p.created_at,
|
| 253 |
253 |
|
u.username,
|
| 254 |
|
- |
COUNT(i.id) FILTER (WHERE i.is_public = true) as item_count,
|
|
254 |
+ |
COUNT(i.id) FILTER (WHERE i.is_public = true AND i.listed = true) as item_count,
|
| 255 |
255 |
|
GREATEST(
|
| 256 |
256 |
|
similarity(p.title, $1),
|
| 257 |
257 |
|
similarity(COALESCE(p.description, ''), $1) * 0.5
|
| 275 |
275 |
|
p.project_type,
|
| 276 |
276 |
|
p.created_at,
|
| 277 |
277 |
|
u.username,
|
| 278 |
|
- |
COUNT(i.id) FILTER (WHERE i.is_public = true) as item_count,
|
|
278 |
+ |
COUNT(i.id) FILTER (WHERE i.is_public = true AND i.listed = true) as item_count,
|
| 279 |
279 |
|
NULL::real as match_score,
|
| 280 |
280 |
|
pc.name as category_name,
|
| 281 |
281 |
|
pc.slug as category_slug
|
| 392 |
392 |
|
SELECT i.item_type as category, COUNT(*) as count
|
| 393 |
393 |
|
FROM items i
|
| 394 |
394 |
|
JOIN projects p ON i.project_id = p.id
|
| 395 |
|
- |
WHERE i.is_public = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
|
395 |
+ |
WHERE i.is_public = true AND i.listed = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
| 396 |
396 |
|
"#,
|
| 397 |
397 |
|
);
|
| 398 |
398 |
|
|
| 456 |
456 |
|
COUNT(*) FILTER (WHERE i.price_cents >= 10000) as over_100
|
| 457 |
457 |
|
FROM items i
|
| 458 |
458 |
|
JOIN projects p ON i.project_id = p.id
|
| 459 |
|
- |
WHERE i.is_public = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
|
459 |
+ |
WHERE i.is_public = true AND i.listed = true AND p.is_public = true AND i.scan_status != 'quarantined'
|
| 460 |
460 |
|
"#,
|
| 461 |
461 |
|
);
|
| 462 |
462 |
|
|