liquid_feedback_core

view update/core-update.v1.2.5-v1.2.6.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 dcaa1525c388
children
line source
1 BEGIN;
3 CREATE OR REPLACE VIEW "liquid_feedback_version" AS
4 SELECT * FROM (VALUES ('1.2.6', 1, 2, 6))
5 AS "subquery"("string", "major", "minor", "revision");
7 CREATE VIEW "active_delegation" AS
8 SELECT "delegation".* FROM "delegation"
9 JOIN "member" ON "delegation"."truster_id" = "member"."id"
10 WHERE "member"."active" = TRUE;
12 COMMENT ON VIEW "active_delegation" IS 'Delegations where the truster_id refers to an active member';
14 DROP VIEW "global_delegation";
16 CREATE VIEW "global_delegation" AS
17 SELECT * FROM "active_delegation"
18 WHERE "scope" = 'global';
20 COMMENT ON VIEW "global_delegation" IS 'Global delegations from active members';
22 CREATE OR REPLACE VIEW "area_delegation" AS
23 SELECT DISTINCT ON ("area"."id", "delegation"."truster_id")
24 "area"."id" AS "area_id",
25 "delegation"."id",
26 "delegation"."truster_id",
27 "delegation"."trustee_id",
28 "delegation"."scope"
29 FROM "area" JOIN "active_delegation" AS "delegation"
30 ON "delegation"."scope" = 'global'
31 OR "delegation"."area_id" = "area"."id"
32 ORDER BY
33 "area"."id",
34 "delegation"."truster_id",
35 "delegation"."scope" DESC;
37 COMMENT ON VIEW "area_delegation" IS 'Resulting area delegations from active members';
39 CREATE OR REPLACE VIEW "issue_delegation" AS
40 SELECT DISTINCT ON ("issue"."id", "delegation"."truster_id")
41 "issue"."id" AS "issue_id",
42 "delegation"."id",
43 "delegation"."truster_id",
44 "delegation"."trustee_id",
45 "delegation"."scope"
46 FROM "issue" JOIN "active_delegation" AS "delegation"
47 ON "delegation"."scope" = 'global'
48 OR "delegation"."area_id" = "issue"."area_id"
49 OR "delegation"."issue_id" = "issue"."id"
50 ORDER BY
51 "issue"."id",
52 "delegation"."truster_id",
53 "delegation"."scope" DESC;
55 COMMENT ON VIEW "issue_delegation" IS 'Resulting issue delegations from active members';
57 COMMIT;

Impressum / About Us