liquid_feedback_core
changeset 144:259dd3e127c0
Removed vote_now/vote_later feature
author | jbe |
---|---|
date | Thu Jun 02 00:48:48 2011 +0200 (2011-06-02) |
parents | 9d78380d1974 |
children | 37a264fb5eef |
files | core.sql |
line diff
1.1 --- a/core.sql Wed Jun 01 18:03:22 2011 +0200 1.2 +++ b/core.sql Thu Jun 02 00:48:48 2011 +0200 1.3 @@ -445,8 +445,6 @@ 1.4 "snapshot" TIMESTAMPTZ, 1.5 "latest_snapshot_event" "snapshot_event", 1.6 "population" INT4, 1.7 - "vote_now" INT4, 1.8 - "vote_later" INT4, 1.9 "voter_count" INT4, 1.10 CONSTRAINT "valid_state" CHECK (( 1.11 ("accepted" ISNULL AND "half_frozen" ISNULL AND "fully_frozen" ISNULL AND "closed" ISNULL AND "ranks_available" = FALSE) OR 1.12 @@ -506,11 +504,9 @@ 1.13 COMMENT ON COLUMN "issue"."discussion_time" IS 'Copied from "policy" table at creation of issue'; 1.14 COMMENT ON COLUMN "issue"."verification_time" IS 'Copied from "policy" table at creation of issue'; 1.15 COMMENT ON COLUMN "issue"."voting_time" IS 'Copied from "policy" table at creation of issue'; 1.16 -COMMENT ON COLUMN "issue"."snapshot" IS 'Point in time, when snapshot tables have been updated and "population", "vote_now", "vote_later" and *_count values were precalculated'; 1.17 +COMMENT ON COLUMN "issue"."snapshot" IS 'Point in time, when snapshot tables have been updated and "population" and *_count values were precalculated'; 1.18 COMMENT ON COLUMN "issue"."latest_snapshot_event" IS 'Event type of latest snapshot for issue; Can be used to select the latest snapshot data in the snapshot tables'; 1.19 COMMENT ON COLUMN "issue"."population" IS 'Sum of "weight" column in table "direct_population_snapshot"'; 1.20 -COMMENT ON COLUMN "issue"."vote_now" IS 'Number of votes in favor of voting now, as calculated from table "direct_interest_snapshot"'; 1.21 -COMMENT ON COLUMN "issue"."vote_later" IS 'Number of votes against voting now, as calculated from table "direct_interest_snapshot"'; 1.22 COMMENT ON COLUMN "issue"."voter_count" IS 'Total number of direct and delegating voters; This value is related to the final voting, while "population" is related to snapshots before the final voting'; 1.23 1.24 1.25 @@ -752,14 +748,12 @@ 1.26 PRIMARY KEY ("issue_id", "member_id"), 1.27 "issue_id" INT4 REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.28 "member_id" INT4 REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.29 - "autoreject" BOOLEAN, 1.30 - "voting_requested" BOOLEAN ); 1.31 + "autoreject" BOOLEAN ); 1.32 CREATE INDEX "interest_member_id_idx" ON "interest" ("member_id"); 1.33 1.34 COMMENT ON TABLE "interest" IS 'Interest of members in a particular issue; Frontends must ensure that interest for fully_frozen or closed issues is not added or removed.'; 1.35 1.36 COMMENT ON COLUMN "interest"."autoreject" IS 'TRUE = member votes against all initiatives in case of not explicitly taking part in the voting procedure'; 1.37 -COMMENT ON COLUMN "interest"."voting_requested" IS 'TRUE = member wants to vote now, FALSE = member wants to vote later, NULL = policy rules should apply'; 1.38 1.39 1.40 CREATE TABLE "initiator" ( 1.41 @@ -875,15 +869,13 @@ 1.42 "issue_id" INT4 REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.43 "event" "snapshot_event", 1.44 "member_id" INT4 REFERENCES "member" ("id") ON DELETE RESTRICT ON UPDATE RESTRICT, 1.45 - "weight" INT4, 1.46 - "voting_requested" BOOLEAN ); 1.47 + "weight" INT4 ); 1.48 CREATE INDEX "direct_interest_snapshot_member_id_idx" ON "direct_interest_snapshot" ("member_id"); 1.49 1.50 COMMENT ON TABLE "direct_interest_snapshot" IS 'Snapshot of active members having an "interest" in the "issue"'; 1.51 1.52 COMMENT ON COLUMN "direct_interest_snapshot"."event" IS 'Reason for snapshot, see "snapshot_event" type for details'; 1.53 COMMENT ON COLUMN "direct_interest_snapshot"."weight" IS 'Weight of member (1 or higher) according to "delegating_interest_snapshot"'; 1.54 -COMMENT ON COLUMN "direct_interest_snapshot"."voting_requested" IS 'Copied from column "voting_requested" of table "interest"'; 1.55 1.56 1.57 CREATE TABLE "delegating_interest_snapshot" ( 1.58 @@ -2952,12 +2944,11 @@ 1.59 WHERE "issue_id" = "issue_id_p" 1.60 AND "event" = 'periodic'; 1.61 INSERT INTO "direct_interest_snapshot" 1.62 - ("issue_id", "event", "member_id", "voting_requested") 1.63 + ("issue_id", "event", "member_id") 1.64 SELECT 1.65 "issue_id_p" AS "issue_id", 1.66 'periodic' AS "event", 1.67 - "member"."id" AS "member_id", 1.68 - "interest"."voting_requested" 1.69 + "member"."id" AS "member_id" 1.70 FROM "issue" 1.71 JOIN "area" ON "issue"."area_id" = "area"."id" 1.72 JOIN "interest" ON "issue"."id" = "interest"."issue_id" 1.73 @@ -3035,20 +3026,6 @@ 1.74 FROM "direct_population_snapshot" 1.75 WHERE "issue_id" = "issue_id_p" 1.76 AND "event" = 'periodic' 1.77 - ), 1.78 - "vote_now" = ( 1.79 - SELECT coalesce(sum("weight"), 0) 1.80 - FROM "direct_interest_snapshot" 1.81 - WHERE "issue_id" = "issue_id_p" 1.82 - AND "event" = 'periodic' 1.83 - AND "voting_requested" = TRUE 1.84 - ), 1.85 - "vote_later" = ( 1.86 - SELECT coalesce(sum("weight"), 0) 1.87 - FROM "direct_interest_snapshot" 1.88 - WHERE "issue_id" = "issue_id_p" 1.89 - AND "event" = 'periodic' 1.90 - AND "voting_requested" = FALSE 1.91 ) 1.92 WHERE "id" = "issue_id_p"; 1.93 FOR "initiative_id_v" IN 1.94 @@ -3922,7 +3899,6 @@ 1.95 DECLARE 1.96 "issue_row" "issue"%ROWTYPE; 1.97 "policy_row" "policy"%ROWTYPE; 1.98 - "voting_requested_v" BOOLEAN; 1.99 BEGIN 1.100 PERFORM "lock_issue"("issue_id_p"); 1.101 SELECT * INTO "issue_row" FROM "issue" WHERE "id" = "issue_id_p"; 1.102 @@ -3970,21 +3946,8 @@ 1.103 "issue_row"."accepted" NOTNULL AND 1.104 "issue_row"."half_frozen" ISNULL 1.105 THEN 1.106 - SELECT 1.107 - CASE 1.108 - WHEN "vote_now" * 2 > "issue_row"."population" THEN 1.109 - TRUE 1.110 - WHEN "vote_later" * 2 > "issue_row"."population" THEN 1.111 - FALSE 1.112 - ELSE NULL 1.113 - END 1.114 - INTO "voting_requested_v" 1.115 - FROM "issue" WHERE "id" = "issue_id_p"; 1.116 IF 1.117 - "voting_requested_v" OR ( 1.118 - "voting_requested_v" ISNULL AND 1.119 - now() >= "issue_row"."accepted" + "issue_row"."discussion_time" 1.120 - ) 1.121 + now() >= "issue_row"."accepted" + "issue_row"."discussion_time" 1.122 THEN 1.123 PERFORM "set_snapshot_event"("issue_id_p", 'half_freeze'); 1.124 -- NOTE: "issue_row" used later