liquid_feedback_core

diff core.sql @ 305:a839e7efde9f

Removed unwanted (and broken) tie-breaking by approval rate
author jbe
date Fri Oct 05 11:41:51 2012 +0200 (2012-10-05)
parents a1db85ce10ea
children 847d59f94ceb
line diff
     1.1 --- a/core.sql	Wed Jun 20 21:22:02 2012 +0200
     1.2 +++ b/core.sql	Fri Oct 05 11:41:51 2012 +0200
     1.3 @@ -7,7 +7,7 @@
     1.4  BEGIN;
     1.5  
     1.6  CREATE VIEW "liquid_feedback_version" AS
     1.7 -  SELECT * FROM (VALUES ('2.0.11', 2, 0, 11))
     1.8 +  SELECT * FROM (VALUES ('2.0.12', 2, 0, 12))
     1.9    AS "subquery"("string", "major", "minor", "revision");
    1.10  
    1.11  
    1.12 @@ -2796,37 +2796,6 @@
    1.13  
    1.14  
    1.15  
    1.16 -------------------------------
    1.17 --- Comparison by vote count --
    1.18 -------------------------------
    1.19 -
    1.20 -CREATE FUNCTION "vote_ratio"
    1.21 -  ( "positive_votes_p" "initiative"."positive_votes"%TYPE,
    1.22 -    "negative_votes_p" "initiative"."negative_votes"%TYPE )
    1.23 -  RETURNS FLOAT8
    1.24 -  LANGUAGE 'plpgsql' STABLE AS $$
    1.25 -    BEGIN
    1.26 -      IF "positive_votes_p" > 0 AND "negative_votes_p" > 0 THEN
    1.27 -        RETURN
    1.28 -          "positive_votes_p"::FLOAT8 /
    1.29 -          ("positive_votes_p" + "negative_votes_p")::FLOAT8;
    1.30 -      ELSIF "positive_votes_p" > 0 THEN
    1.31 -        RETURN "positive_votes_p";
    1.32 -      ELSIF "negative_votes_p" > 0 THEN
    1.33 -        RETURN 1 - "negative_votes_p";
    1.34 -      ELSE
    1.35 -        RETURN 0.5;
    1.36 -      END IF;
    1.37 -    END;
    1.38 -  $$;
    1.39 -
    1.40 -COMMENT ON FUNCTION "vote_ratio"
    1.41 -  ( "initiative"."positive_votes"%TYPE,
    1.42 -    "initiative"."negative_votes"%TYPE )
    1.43 -  IS 'Returns a number, which can be used for comparison of initiatives based on count of approvals and disapprovals. Greater numbers indicate a better result. This function is NOT injective.';
    1.44 -
    1.45 -
    1.46 -
    1.47  ------------------------------------------------
    1.48  -- Locking for snapshots and voting procedure --
    1.49  ------------------------------------------------
    1.50 @@ -4054,7 +4023,6 @@
    1.51            WHERE "issue_id" = "issue_id_p" AND "eligible"
    1.52            ORDER BY
    1.53              "schulze_rank",
    1.54 -            "vote_ratio"("positive_votes", "negative_votes"),
    1.55              "id"
    1.56            LIMIT 1
    1.57          ) AS "subquery"
    1.58 @@ -4069,7 +4037,6 @@
    1.59            "winner" DESC,
    1.60            "eligible" DESC,
    1.61            "schulze_rank",
    1.62 -          "vote_ratio"("positive_votes", "negative_votes"),
    1.63            "id"
    1.64        LOOP
    1.65          UPDATE "initiative" SET "rank" = "rank_v"

Impressum / About Us