liquid_feedback_core
changeset 261:6b2c80028b47
Polling mode
author | jbe |
---|---|
date | Sun Jul 15 21:38:04 2012 +0200 (2012-07-15) |
parents | 878f84407290 |
children | e02b8c492e26 |
files | core.sql |
line diff
1.1 --- a/core.sql Sun Jul 15 19:30:16 2012 +0200 1.2 +++ b/core.sql Sun Jul 15 21:38:04 2012 +0200 1.3 @@ -328,11 +328,11 @@ 1.4 "active" BOOLEAN NOT NULL DEFAULT TRUE, 1.5 "name" TEXT NOT NULL UNIQUE, 1.6 "description" TEXT NOT NULL DEFAULT '', 1.7 - "free_timing" BOOLEAN NOT NULL DEFAULT FALSE, 1.8 - "admission_time" INTERVAL NOT NULL, 1.9 - "discussion_time" INTERVAL NOT NULL, 1.10 - "verification_time" INTERVAL NOT NULL, 1.11 - "voting_time" INTERVAL NOT NULL, 1.12 + "polling" BOOLEAN NOT NULL DEFAULT FALSE, 1.13 + "admission_time" INTERVAL, 1.14 + "discussion_time" INTERVAL, 1.15 + "verification_time" INTERVAL, 1.16 + "voting_time" INTERVAL, 1.17 "issue_quorum_num" INT4 NOT NULL, 1.18 "issue_quorum_den" INT4 NOT NULL, 1.19 "initiative_quorum_num" INT4 NOT NULL, 1.20 @@ -350,10 +350,13 @@ 1.21 "no_reverse_beat_path" BOOLEAN NOT NULL DEFAULT TRUE, 1.22 "no_multistage_majority" BOOLEAN NOT NULL DEFAULT FALSE, 1.23 CONSTRAINT "timing" CHECK ( 1.24 - ( "free_timing" = FALSE AND 1.25 + ( "polling" = FALSE AND 1.26 "admission_time" NOTNULL AND "discussion_time" NOTNULL AND 1.27 "verification_time" NOTNULL AND "voting_time" NOTNULL ) OR 1.28 - ( "free_timing" = TRUE AND 1.29 + ( "polling" = TRUE AND 1.30 + "admission_time" NOTNULL AND "discussion_time" NOTNULL AND 1.31 + "verification_time" NOTNULL AND "voting_time" NOTNULL ) OR 1.32 + ( "polling" = TRUE AND 1.33 "admission_time" ISNULL AND "discussion_time" ISNULL AND 1.34 "verification_time" ISNULL AND "voting_time" ISNULL ) ) ); 1.35 CREATE INDEX "policy_active_idx" ON "policy" ("active"); 1.36 @@ -362,7 +365,7 @@ 1.37 1.38 COMMENT ON COLUMN "policy"."index" IS 'Determines the order in listings'; 1.39 COMMENT ON COLUMN "policy"."active" IS 'TRUE = policy can be used for new issues'; 1.40 -COMMENT ON COLUMN "policy"."free_timing" IS 'TRUE = special policy for non-user-generated issues without predefined timing (all _time fields must be set to NULL then)'; 1.41 +COMMENT ON COLUMN "policy"."polling" IS 'TRUE = special policy for non-user-generated issues, i.e. polls (time values may be set to NULL, allowing individual timing for issues)'; 1.42 COMMENT ON COLUMN "policy"."admission_time" IS 'Maximum duration of issue state ''admission''; Maximum time an issue stays open without being "accepted"'; 1.43 COMMENT ON COLUMN "policy"."discussion_time" IS 'Duration of issue state ''discussion''; Regular time until an issue is "half_frozen" after being "accepted"'; 1.44 COMMENT ON COLUMN "policy"."verification_time" IS 'Duration of issue state ''verification''; Regular time until an issue is "fully_frozen" (e.g. entering issue state ''voting'') after being "half_frozen"'; 1.45 @@ -586,6 +589,7 @@ 1.46 "issue_id" INT4 NOT NULL REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.47 "id" SERIAL4 PRIMARY KEY, 1.48 "name" TEXT NOT NULL, 1.49 + "polling" BOOLEAN NOT NULL DEFAULT FALSE, 1.50 "discussion_url" TEXT, 1.51 "created" TIMESTAMPTZ NOT NULL DEFAULT now(), 1.52 "revoked" TIMESTAMPTZ, 1.53 @@ -642,6 +646,7 @@ 1.54 1.55 COMMENT ON TABLE "initiative" IS 'Group of members publishing drafts for resolutions to be passed; Frontends must ensure that initiatives of half_frozen issues are not revoked, and that initiatives of fully_frozen or closed issues are neither revoked nor created.'; 1.56 1.57 +COMMENT ON COLUMN "initiative"."polling" IS 'Initiative is an option for a poll (see "policy"."polling"), and does not need to pass the initiative quorum'; 1.58 COMMENT ON COLUMN "initiative"."discussion_url" IS 'URL pointing to a discussion platform for this initiative'; 1.59 COMMENT ON COLUMN "initiative"."revoked" IS 'Point in time, when one initiator decided to revoke the initiative'; 1.60 COMMENT ON COLUMN "initiative"."revoked_by_member_id" IS 'Member, who decided to revoke the initiative'; 1.61 @@ -801,16 +806,20 @@ 1.62 "admin_manager" BOOLEAN NOT NULL DEFAULT FALSE, 1.63 "unit_manager" BOOLEAN NOT NULL DEFAULT FALSE, 1.64 "area_manager" BOOLEAN NOT NULL DEFAULT FALSE, 1.65 - "voting_right_manager" BOOLEAN NOT NULL DEFAULT FALSE, 1.66 - "voting_right" BOOLEAN NOT NULL DEFAULT TRUE ); 1.67 + "member_manager" BOOLEAN NOT NULL DEFAULT FALSE, 1.68 + "initiative_right" BOOLEAN NOT NULL DEFAULT TRUE, 1.69 + "voting_right" BOOLEAN NOT NULL DEFAULT TRUE, 1.70 + "polling_right" BOOLEAN NOT NULL DEFAULT FALSE ); 1.71 1.72 COMMENT ON TABLE "privilege" IS 'Members rights related to each unit'; 1.73 1.74 -COMMENT ON COLUMN "privilege"."admin_manager" IS 'Grant/revoke admin privileges to/from other members'; 1.75 +COMMENT ON COLUMN "privilege"."admin_manager" IS 'Grant/revoke any privileges to/from other members'; 1.76 COMMENT ON COLUMN "privilege"."unit_manager" IS 'Create and disable sub units'; 1.77 COMMENT ON COLUMN "privilege"."area_manager" IS 'Create and disable areas and set area parameters'; 1.78 -COMMENT ON COLUMN "privilege"."voting_right_manager" IS 'Select which members are allowed to discuss and vote within the unit'; 1.79 -COMMENT ON COLUMN "privilege"."voting_right" IS 'Right to discuss and vote'; 1.80 +COMMENT ON COLUMN "privilege"."member_manager" IS 'Adding/removing members from the unit, granting or revoking "initiative_right" and "voting_right"'; 1.81 +COMMENT ON COLUMN "privilege"."initiative_right" IS 'Right to create an initiative'; 1.82 +COMMENT ON COLUMN "privilege"."voting_right" IS 'Right to support initiatives, create and rate suggestions, and to vote'; 1.83 +COMMENT ON COLUMN "privilege"."polling_right" IS 'Right to create polls (see "policy"."polling" and "initiative"."polling")'; 1.84 1.85 1.86 CREATE TABLE "membership" ( 1.87 @@ -3509,10 +3518,12 @@ 1.88 WHERE "issue_id" = "issue_id_p" AND "revoked" ISNULL 1.89 LOOP 1.90 IF 1.91 - "initiative_row"."satisfied_supporter_count" > 0 AND 1.92 - "initiative_row"."satisfied_supporter_count" * 1.93 - "policy_row"."initiative_quorum_den" >= 1.94 - "issue_row"."population" * "policy_row"."initiative_quorum_num" 1.95 + "initiative_row"."polling" OR ( 1.96 + "initiative_row"."satisfied_supporter_count" > 0 AND 1.97 + "initiative_row"."satisfied_supporter_count" * 1.98 + "policy_row"."initiative_quorum_den" >= 1.99 + "issue_row"."population" * "policy_row"."initiative_quorum_num" 1.100 + ) 1.101 THEN 1.102 UPDATE "initiative" SET "admitted" = TRUE 1.103 WHERE "id" = "initiative_row"."id";