From 79fc4de7c8f55ce9ca25251357d6002dd1baea0b Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sun, 25 Oct 2015 12:28:35 +0100 Subject: DB::ULists: Revert change from 'numeric' to 'float' to fix vote graphs Broken in bbe989de364ddc654bfc6385e22f1eaff23faad1. I forgot that floats can't accurately represent some .5 numbers. --- lib/VNDB/DB/ULists.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/VNDB/DB') diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm index 55ee9e37..23bde7cf 100644 --- a/lib/VNDB/DB/ULists.pm +++ b/lib/VNDB/DB/ULists.pm @@ -238,11 +238,11 @@ sub dbVoteStats { my $u = $self->authInfo->{id}; my $r = [ map [0,0], 0..9 ]; $r->[$_->{idx}] = [ $_->{votes}, $_->{total} ] for (@{$self->dbAll(q| - SELECT (vote::float/10)::int-1 AS idx, COUNT(vote) as votes, SUM(vote) AS total + SELECT (vote::numeric/10)::int-1 AS idx, COUNT(vote) as votes, SUM(vote) AS total FROM votes !s !W - GROUP BY (vote::float/10)::int|, + GROUP BY (vote::numeric/10)::int|, $ign ? 'JOIN users ON id = uid AND (NOT ign_votes'.($u?sprintf(' OR id = %d',$u):'').')' : '', $col ? { '!s = ?' => [ $col, $id ] } : {}, )}); -- cgit v1.2.3