liquid_feedback_core

diff demo.sql @ 139:e3bfa2d7954c

Always ensure stable voting results by disqualifying certain initiatives, and bugfix related to setting "issue_state" in "calculate_ranks"

- Removed column "majority_indirect" from table "policy"
- Removed column "eligible" from table "initiative" ("eligible" can be calculated as "attainable"=TRUE AND "favored"=TRUE AND "disqualified"=FALSE)
- Split "rank" column of table "initiative" into columns "preliminary_rank" and "final_rank"
- Added column "disqualified" to table "initiative"
- Removed column "promising" from table "initiative"
- Removed constraints from table "initiative"
- Updated functions "close_voting" and "calculate_ranks"
- Added TODO notice in function "clean_issue"
author jbe
date Sun May 29 19:51:16 2011 +0200 (2011-05-29)
parents bd0cd909189d
children 8e7d583e02f9
line diff
     1.1 --- a/demo.sql	Sat May 28 04:35:24 2011 +0200
     1.2 +++ b/demo.sql	Sun May 29 19:51:16 2011 +0200
     1.3 @@ -92,7 +92,7 @@
     1.4    (4,  6, FALSE),
     1.5    (4,  9, FALSE),
     1.6    (4, 13, FALSE),
     1.7 -  (4, 22, TRUE);
     1.8 +  (4, 22, FALSE);
     1.9  
    1.10  -- global delegations
    1.11  INSERT INTO "delegation"
    1.12 @@ -190,31 +190,49 @@
    1.13    (4, 1);  -- id 2
    1.14  
    1.15  INSERT INTO "initiative" ("issue_id", "name") VALUES
    1.16 -  (2, 'Initiative A'),  -- id 8
    1.17 -  (2, 'Initiative B');  -- id 9
    1.18 +  (2, 'Initiative A'),  -- id  8
    1.19 +  (2, 'Initiative B'),  -- id  9
    1.20 +  (2, 'Initiative C'),  -- id 10
    1.21 +  (2, 'Initiative D');  -- id 11
    1.22  
    1.23  INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES
    1.24 -  (8, 1, 'Lorem ipsum...'),  -- id 8
    1.25 -  (9, 2, 'Lorem ipsum...');  -- id 9
    1.26 +  ( 8, 1, 'Lorem ipsum...'),  -- id  8
    1.27 +  ( 9, 2, 'Lorem ipsum...'),  -- id  9
    1.28 +  (10, 3, 'Lorem ipsum...'),  -- id 10
    1.29 +  (11, 4, 'Lorem ipsum...');  -- id 11
    1.30  
    1.31  INSERT INTO "initiator" ("initiative_id", "member_id") VALUES
    1.32 -  (8, 1),
    1.33 -  (9, 2);
    1.34 +  ( 8, 1),
    1.35 +  ( 9, 2),
    1.36 +  (10, 3),
    1.37 +  (11, 4);
    1.38  
    1.39  INSERT INTO "supporter" ("member_id", "initiative_id", "draft_id") VALUES
    1.40 -  (1, 8, 8),
    1.41 -  (1, 9, 9),
    1.42 -  (2, 8, 8),
    1.43 -  (2, 9, 9),
    1.44 -  (3, 8, 8),
    1.45 -  (3, 9, 9),
    1.46 -  (4, 8, 8),
    1.47 -  (4, 9, 9),
    1.48 -  (5, 8, 8),
    1.49 -  (5, 9, 9),
    1.50 -  (6, 8, 8),
    1.51 -  (6, 9, 9);
    1.52 -
    1.53 +  (1,  8,  8),
    1.54 +  (1,  9,  9),
    1.55 +  (1, 10, 10),
    1.56 +  (1, 11, 11),
    1.57 +  (2,  8,  8),
    1.58 +  (2,  9,  9),
    1.59 +  (2, 10, 10),
    1.60 +  (2, 11, 11),
    1.61 +  (3,  8,  8),
    1.62 +  (3,  9,  9),
    1.63 +  (3, 10, 10),
    1.64 +  (3, 11, 11),
    1.65 +  (4,  8,  8),
    1.66 +  (4,  9,  9),
    1.67 +  (4, 10, 10),
    1.68 +  (4, 11, 11),
    1.69 +  (5,  8,  8),
    1.70 +  (5,  9,  9),
    1.71 +  (5, 10, 10),
    1.72 +  (5, 11, 11),
    1.73 +  (6,  8,  8),
    1.74 +  (6,  9,  9),
    1.75 +  (6, 10, 10),
    1.76 +  (6, 11, 11);
    1.77 + 
    1.78  SELECT "time_warp"();
    1.79  SELECT "time_warp"();
    1.80  SELECT "time_warp"();
    1.81 @@ -299,46 +317,86 @@
    1.82    (20, 2);
    1.83  
    1.84  INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES
    1.85 -  ( 1, 2, 8,  2),
    1.86 -  ( 1, 2, 9,  1),
    1.87 -  ( 2, 2, 8,  2),
    1.88 -  ( 2, 2, 9,  1),
    1.89 -  ( 3, 2, 8,  2),
    1.90 -  ( 3, 2, 9,  1),
    1.91 -  ( 4, 2, 8,  2),
    1.92 -  ( 4, 2, 9,  1),
    1.93 -  ( 5, 2, 8,  2),
    1.94 -  ( 5, 2, 9,  1),
    1.95 -  ( 6, 2, 8,  2),
    1.96 -  ( 6, 2, 9,  1),
    1.97 -  ( 7, 2, 8,  2),
    1.98 -  ( 7, 2, 9,  1),
    1.99 -  ( 8, 2, 8,  2),
   1.100 -  ( 8, 2, 9,  1),
   1.101 -  ( 9, 2, 8,  2),
   1.102 -  ( 9, 2, 9,  1),
   1.103 -  (10, 2, 8, -1),
   1.104 -  (10, 2, 9,  1),
   1.105 -  (11, 2, 8, -1),
   1.106 -  (11, 2, 9,  1),
   1.107 -  (12, 2, 8, -1),
   1.108 -  (12, 2, 9,  1),
   1.109 -  (13, 2, 8, -1),
   1.110 -  (13, 2, 9,  1),
   1.111 -  (14, 2, 8, -1),
   1.112 -  (14, 2, 9,  1),
   1.113 -  (15, 2, 8, -1),
   1.114 -  (15, 2, 9,  1),
   1.115 -  (16, 2, 8, -1),
   1.116 -  (16, 2, 9,  1),
   1.117 -  (17, 2, 8, -1),
   1.118 -  (17, 2, 9, -2),
   1.119 -  (18, 2, 8, -1),
   1.120 -  (18, 2, 9, -2),
   1.121 -  (19, 2, 8, -1),
   1.122 -  (19, 2, 9, -2),
   1.123 -  (20, 2, 8, -1),
   1.124 -  (20, 2, 9, -2);
   1.125 +  ( 1, 2,  8,  3),
   1.126 +  ( 1, 2,  9,  4),
   1.127 +  ( 1, 2, 10,  2),
   1.128 +  ( 1, 2, 11,  1),
   1.129 +  ( 2, 2,  8,  3),
   1.130 +  ( 2, 2,  9,  4),
   1.131 +  ( 2, 2, 10,  2),
   1.132 +  ( 2, 2, 11,  1),
   1.133 +  ( 3, 2,  8,  4),
   1.134 +  ( 3, 2,  9,  3),
   1.135 +  ( 3, 2, 10,  2),
   1.136 +  ( 3, 2, 11,  1),
   1.137 +  ( 4, 2,  8,  4),
   1.138 +  ( 4, 2,  9,  3),
   1.139 +  ( 4, 2, 10,  2),
   1.140 +  ( 4, 2, 11,  1),
   1.141 +  ( 5, 2,  8,  4),
   1.142 +  ( 5, 2,  9,  3),
   1.143 +  ( 5, 2, 10,  2),
   1.144 +  ( 5, 2, 11,  1),
   1.145 +  ( 6, 2,  8,  4),
   1.146 +  ( 6, 2,  9,  3),
   1.147 +  ( 6, 2, 10,  2),
   1.148 +  ( 6, 2, 11,  1),
   1.149 +  ( 7, 2,  8,  4),
   1.150 +  ( 7, 2,  9,  3),
   1.151 +  ( 7, 2, 10,  2),
   1.152 +  ( 7, 2, 11,  1),
   1.153 +  ( 8, 2,  8,  4),
   1.154 +  ( 8, 2,  9,  3),
   1.155 +  ( 8, 2, 10,  2),
   1.156 +  ( 8, 2, 11,  1),
   1.157 +  ( 9, 2,  8, -1),
   1.158 +  ( 9, 2,  9,  1),
   1.159 +  ( 9, 2, 10,  3),
   1.160 +  ( 9, 2, 11,  2),
   1.161 +  (10, 2,  8, -1),
   1.162 +  (10, 2,  9,  1),
   1.163 +  (10, 2, 10,  3),
   1.164 +  (10, 2, 11,  2),
   1.165 +  (11, 2,  8, -1),
   1.166 +  (11, 2,  9,  1),
   1.167 +  (11, 2, 10,  3),
   1.168 +  (11, 2, 11,  2),
   1.169 +  (12, 2,  8, -1),
   1.170 +  (12, 2,  9,  1),
   1.171 +  (12, 2, 10,  3),
   1.172 +  (12, 2, 11,  2),
   1.173 +  (13, 2,  8, -1),
   1.174 +  (13, 2,  9,  1),
   1.175 +  (13, 2, 10,  3),
   1.176 +  (13, 2, 11,  2),
   1.177 +  (14, 2,  8, -1),
   1.178 +  (14, 2,  9,  1),
   1.179 +  (14, 2, 10,  3),
   1.180 +  (14, 2, 11,  2),
   1.181 +  (15, 2,  8, -1),
   1.182 +  (15, 2,  9, -3),
   1.183 +  (15, 2, 10, -4),
   1.184 +  (15, 2, 11, -2),
   1.185 +  (16, 2,  8, -1),
   1.186 +  (16, 2,  9, -3),
   1.187 +  (16, 2, 10, -4),
   1.188 +  (16, 2, 11, -2),
   1.189 +  (17, 2,  8, -1),
   1.190 +  (17, 2,  9, -3),
   1.191 +  (17, 2, 10, -4),
   1.192 +  (17, 2, 11, -2),
   1.193 +  (18, 2,  8, -1),
   1.194 +  (18, 2,  9,  1),
   1.195 +  (18, 2, 10, -2),
   1.196 +  (18, 2, 11,  2),
   1.197 +  (19, 2,  8, -1),
   1.198 +  (19, 2,  9,  1),
   1.199 +  (19, 2, 10, -2),
   1.200 +  (19, 2, 11,  2),
   1.201 +  (20, 2,  8,  1),
   1.202 +  (20, 2,  9,  2),
   1.203 +  (20, 2, 10, -1),
   1.204 +  (20, 2, 11,  3);
   1.205  
   1.206  SELECT "time_warp"();
   1.207  

Impressum / About Us