summaryrefslogtreecommitdiff
path: root/lib/VNDB
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-07-12 09:35:11 +0200
committerYorhel <git@yorhel.nl>2020-07-12 09:35:13 +0200
commit339839746344245f8f6bf20eb0403d52283474a1 (patch)
tree85779f7d74d0406c065a1584552a6d7fbd255f70 /lib/VNDB
parent5508f490620eb32c4993c6b05153f85de1ebadac (diff)
DB::VN: Exclude deleted VNs in random screenshot selection
Deleted VNs could only be selected in the rare scenario where the screenshots from the deleted entry have also been assigned to another (non-deleted) entry. Fully deleted screenshots would already have been excluded with the c_weight check. Fixes https://vndb.org/t2520.457
Diffstat (limited to 'lib/VNDB')
-rw-r--r--lib/VNDB/DB/VN.pm1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index abe3b1a8..6061c57c 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -341,6 +341,7 @@ sub dbScreenshotRandom {
) i(id)
JOIN vn_screenshots vs ON vs.scr = i.id
JOIN vn v ON v.id = vs.id
+ WHERE NOT v.hidden
ORDER BY random()
LIMIT 4
}, $sample);