summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-01-23 09:43:54 +0100
committerYorhel <git@yorhel.nl>2010-01-23 09:43:54 +0100
commite3920cf7242fb4782f8fd296d08f27b4fca9fe74 (patch)
treefe1918801c1c7c66813948d15cbbf47fbf071474 /lib
parent501b679bacc6985cc8ef30e6df6511ce2bd295a2 (diff)
DB::VN: Fixed ranking bug on VN pages with a NULL popularity or rating
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/VN.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm
index b8cc0c42..6ff74d1f 100644
--- a/lib/VNDB/DB/VN.pm
+++ b/lib/VNDB/DB/VN.pm
@@ -90,8 +90,8 @@ sub dbVNGet {
$o{what} =~ /relgraph/ ? 'vg.svg' : (),
$o{what} =~ /rating/ ? (qw|v.c_popularity v.c_rating v.c_votecount|) : (),
$o{what} =~ /ranking/ ? (
- '(SELECT COUNT(*)+1 FROM vn iv WHERE iv.hidden = false AND iv.c_popularity > v.c_popularity) AS p_ranking',
- '(SELECT COUNT(*)+1 FROM vn iv WHERE iv.hidden = false AND iv.c_rating > v.c_rating) AS r_ranking',
+ '(SELECT COUNT(*)+1 FROM vn iv WHERE iv.hidden = false AND iv.c_popularity > COALESCE(v.c_popularity, 0.0)) AS p_ranking',
+ '(SELECT COUNT(*)+1 FROM vn iv WHERE iv.hidden = false AND iv.c_rating > COALESCE(v.c_rating, 0.0)) AS r_ranking',
) : (),
# TODO: optimize this, as it will be very slow when the selected tags match a lot of VNs (>1000)
$tag_ids ?