From 3a65d0490f6569efb65dfa32b98239e89f4f2705 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 21 Oct 2024 10:18:29 +0200 Subject: [PATCH] Revert "Exponential controversy rank (#4872)" This reverts commit fd58b4f8096fa9006fe4420878631411c99953fb. --- crates/db_schema/replaceable_schema/utils.sql | 2 +- .../down.sql | 17 ----------------- .../up.sql | 17 ----------------- 3 files changed, 1 insertion(+), 35 deletions(-) delete mode 100644 migrations/2024-07-01-014711_exponential_controversy/down.sql delete mode 100644 migrations/2024-07-01-014711_exponential_controversy/up.sql diff --git a/crates/db_schema/replaceable_schema/utils.sql b/crates/db_schema/replaceable_schema/utils.sql index 26447f2c2..f236c5387 100644 --- a/crates/db_schema/replaceable_schema/utils.sql +++ b/crates/db_schema/replaceable_schema/utils.sql @@ -8,7 +8,7 @@ CREATE FUNCTION r.controversy_rank (upvotes numeric, downvotes numeric) 0 ELSE ( - upvotes + downvotes) ^ CASE WHEN upvotes > downvotes THEN + upvotes + downvotes) * CASE WHEN upvotes > downvotes THEN downvotes::float / upvotes::float ELSE upvotes::float / downvotes::float diff --git a/migrations/2024-07-01-014711_exponential_controversy/down.sql b/migrations/2024-07-01-014711_exponential_controversy/down.sql deleted file mode 100644 index 15a7f296a..000000000 --- a/migrations/2024-07-01-014711_exponential_controversy/down.sql +++ /dev/null @@ -1,17 +0,0 @@ -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; - diff --git a/migrations/2024-07-01-014711_exponential_controversy/up.sql b/migrations/2024-07-01-014711_exponential_controversy/up.sql deleted file mode 100644 index 87a700de3..000000000 --- a/migrations/2024-07-01-014711_exponential_controversy/up.sql +++ /dev/null @@ -1,17 +0,0 @@ -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; -