summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2015-10-25 12:28:35 +0100
committerYorhel <git@yorhel.nl>2015-10-25 12:28:35 +0100
commit79fc4de7c8f55ce9ca25251357d6002dd1baea0b (patch)
tree9b9f865099641645f8d0402216b4d59e2ab0b81e /lib
parentba36a7587afdd5a597631c3430b1995dd4c65e5d (diff)
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/ULists.pm4
1 files changed, 2 insertions, 2 deletions
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 ] } : {},
)});