liquid_feedback_core
diff core.sql @ 307:847d59f94ceb
Merged fix from v2.0.12: Removed unwanted (and broken) tie-breaking by approval rate
author | jbe |
---|---|
date | Fri Oct 05 13:45:37 2012 +0200 (2012-10-05) |
parents | e403f47525ce a839e7efde9f |
children | fa09513482aa 6529e423f8eb |
line diff
1.1 --- a/core.sql Sun Sep 30 12:59:07 2012 +0200 1.2 +++ b/core.sql Fri Oct 05 13:45:37 2012 +0200 1.3 @@ -2860,37 +2860,6 @@ 1.4 1.5 1.6 1.7 ------------------------------- 1.8 --- Comparison by vote count -- 1.9 ------------------------------- 1.10 - 1.11 -CREATE FUNCTION "vote_ratio" 1.12 - ( "positive_votes_p" "initiative"."positive_votes"%TYPE, 1.13 - "negative_votes_p" "initiative"."negative_votes"%TYPE ) 1.14 - RETURNS FLOAT8 1.15 - LANGUAGE 'plpgsql' STABLE AS $$ 1.16 - BEGIN 1.17 - IF "positive_votes_p" > 0 AND "negative_votes_p" > 0 THEN 1.18 - RETURN 1.19 - "positive_votes_p"::FLOAT8 / 1.20 - ("positive_votes_p" + "negative_votes_p")::FLOAT8; 1.21 - ELSIF "positive_votes_p" > 0 THEN 1.22 - RETURN "positive_votes_p"; 1.23 - ELSIF "negative_votes_p" > 0 THEN 1.24 - RETURN 1 - "negative_votes_p"; 1.25 - ELSE 1.26 - RETURN 0.5; 1.27 - END IF; 1.28 - END; 1.29 - $$; 1.30 - 1.31 -COMMENT ON FUNCTION "vote_ratio" 1.32 - ( "initiative"."positive_votes"%TYPE, 1.33 - "initiative"."negative_votes"%TYPE ) 1.34 - 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.35 - 1.36 - 1.37 - 1.38 ------------------------------------------------ 1.39 -- Locking for snapshots and voting procedure -- 1.40 ------------------------------------------------ 1.41 @@ -4130,7 +4099,6 @@ 1.42 WHERE "issue_id" = "issue_id_p" AND "eligible" 1.43 ORDER BY 1.44 "schulze_rank", 1.45 - "vote_ratio"("positive_votes", "negative_votes"), 1.46 "id" 1.47 LIMIT 1 1.48 ) AS "subquery" 1.49 @@ -4145,7 +4113,6 @@ 1.50 "winner" DESC, 1.51 "eligible" DESC, 1.52 "schulze_rank", 1.53 - "vote_ratio"("positive_votes", "negative_votes"), 1.54 "id" 1.55 LOOP 1.56 UPDATE "initiative" SET "rank" = "rank_v"