mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 12:51:18 +00:00
18 lines
365 B
MySQL
18 lines
365 B
MySQL
|
UPDATE
|
||
|
post_aggregates
|
||
|
SET
|
||
|
controversy_rank = CASE WHEN downvotes <= 0
|
||
|
OR upvotes <= 0 THEN
|
||
|
0
|
||
|
ELSE
|
||
|
(upvotes + downvotes) * CASE WHEN upvotes > downvotes THEN
|
||
|
downvotes::float / upvotes::float
|
||
|
ELSE
|
||
|
upvotes::float / downvotes::float
|
||
|
END
|
||
|
END
|
||
|
WHERE
|
||
|
upvotes > 0
|
||
|
AND downvotes > 0;
|
||
|
|