liquid_feedback_core

diff test.sql @ 302:548cec6b7a79

Better tie-breaking
author jbe
date Sat Sep 29 23:41:37 2012 +0200 (2012-09-29)
parents 44e489d77306
children e403f47525ce
line diff
     1.1 --- a/test.sql	Tue Sep 25 13:54:24 2012 +0200
     1.2 +++ b/test.sql	Sat Sep 29 23:41:37 2012 +0200
     1.3 @@ -41,7 +41,8 @@
     1.4      "issue_quorum_num", "issue_quorum_den",
     1.5      "initiative_quorum_num", "initiative_quorum_den",
     1.6      "direct_majority_num", "direct_majority_den", "direct_majority_strict",
     1.7 -    "no_reverse_beat_path", "no_multistage_majority"
     1.8 +    "no_reverse_beat_path", "no_multistage_majority",
     1.9 +    "schulze_variant"
    1.10    ) VALUES (
    1.11      1,
    1.12      'Default policy',
    1.13 @@ -49,7 +50,8 @@
    1.14      25, 100,
    1.15      20, 100,
    1.16      1, 2, TRUE,
    1.17 -    TRUE, FALSE );
    1.18 +    TRUE, FALSE,
    1.19 +    'tie_breaking_with_negative_strength'::"schulze_variant" );
    1.20  
    1.21  CREATE FUNCTION "time_warp"() RETURNS VOID
    1.22    LANGUAGE 'plpgsql' VOLATILE AS $$
    1.23 @@ -118,10 +120,37 @@
    1.24    (18, 'unit', 1, 19),
    1.25    (23, 'unit', 1, 22);
    1.26  
    1.27 +-- no delegations in area #1
    1.28 +INSERT INTO "delegation"
    1.29 +  ("truster_id", "scope", "area_id", "trustee_id") VALUES
    1.30 +  ( 1, 'area', 1, NULL),
    1.31 +  ( 2, 'area', 1, NULL),
    1.32 +  ( 3, 'area', 1, NULL),
    1.33 +  ( 4, 'area', 1, NULL),
    1.34 +  ( 5, 'area', 1, NULL),
    1.35 +  ( 6, 'area', 1, NULL),
    1.36 +  ( 7, 'area', 1, NULL),
    1.37 +  ( 8, 'area', 1, NULL),
    1.38 +  ( 9, 'area', 1, NULL),
    1.39 +  (10, 'area', 1, NULL),
    1.40 +  (11, 'area', 1, NULL),
    1.41 +  (12, 'area', 1, NULL),
    1.42 +  (13, 'area', 1, NULL),
    1.43 +  (14, 'area', 1, NULL),
    1.44 +  (15, 'area', 1, NULL),
    1.45 +  (16, 'area', 1, NULL),
    1.46 +  (17, 'area', 1, NULL),
    1.47 +  (18, 'area', 1, NULL),
    1.48 +  (19, 'area', 1, NULL),
    1.49 +  (20, 'area', 1, NULL),
    1.50 +  (21, 'area', 1, NULL),
    1.51 +  (22, 'area', 1, NULL),
    1.52 +  (23, 'area', 1, NULL);
    1.53 +
    1.54  -- delegations for topics
    1.55  INSERT INTO "delegation"
    1.56    ("area_id", "truster_id", "scope", "trustee_id") VALUES
    1.57 -  (1,  3, 'area', 17),
    1.58 +  --(1,  3, 'area', 17),
    1.59    (2,  5, 'area', 10),
    1.60    (2,  9, 'area', 10),
    1.61    (3,  4, 'area', 14),
    1.62 @@ -236,6 +265,25 @@
    1.63    (6,  9,  9),
    1.64    (6, 10, 10),
    1.65    (6, 11, 11);
    1.66 +
    1.67 +INSERT INTO "issue" ("area_id", "policy_id") VALUES
    1.68 +  (1, 1);  -- id 3
    1.69 +
    1.70 +INSERT INTO "initiative" ("issue_id", "name") VALUES
    1.71 +  (3, 'First initiative'),   -- id 12
    1.72 +  (3, 'Second initiative');  -- id 13
    1.73 +
    1.74 +INSERT INTO "draft" ("initiative_id", "author_id", "content") VALUES
    1.75 +  (12, 1, 'Lorem ipsum...'),  -- id 12
    1.76 +  (13, 2, 'Lorem ipsum...');  -- id 13
    1.77 +
    1.78 +INSERT INTO "initiator" ("initiative_id", "member_id") VALUES
    1.79 +  (12, 1),
    1.80 +  (13, 2);
    1.81 +
    1.82 +INSERT INTO "supporter" ("initiative_id", "member_id") VALUES
    1.83 +  (12, 1),
    1.84 +  (13, 2);
    1.85   
    1.86  SELECT "time_warp"();
    1.87  SELECT "time_warp"();
    1.88 @@ -402,6 +450,25 @@
    1.89    (20, 2, 10, -1),
    1.90    (20, 2, 11,  3);
    1.91  
    1.92 +INSERT INTO "direct_voter" ("member_id", "issue_id") VALUES
    1.93 +  ( 1, 3),
    1.94 +  ( 2, 3),
    1.95 +  ( 3, 3),
    1.96 +  ( 4, 3),
    1.97 +  ( 5, 3);
    1.98 +
    1.99 +INSERT INTO "vote" ("member_id", "issue_id", "initiative_id", "grade") VALUES
   1.100 +  (1, 3, 12,  1),
   1.101 +  (1, 3, 13,  1),
   1.102 +  (2, 3, 12,  1),
   1.103 +  (2, 3, 13,  1),
   1.104 +  (3, 3, 12,  0),
   1.105 +  (3, 3, 13,  1),
   1.106 +  (4, 3, 12,  0),
   1.107 +  (4, 3, 13, -1),
   1.108 +  (5, 3, 12, -1),
   1.109 +  (5, 3, 13, -1);
   1.110 +
   1.111  SELECT "time_warp"();
   1.112  
   1.113  DROP FUNCTION "time_warp"();

Impressum / About Us