liquid_feedback_core

view update/core-update.v2.2.5-v2.2.6.sql @ 402:29835e2525bd

Improved comments/debug output in lf_update_issue_order.c
author jbe
date Sat Oct 12 18:58:51 2013 +0200 (2013-10-12)
parents 782eb17c7ad9
children f7b4457cf1a6
line source
1 BEGIN;
3 CREATE OR REPLACE VIEW "liquid_feedback_version" AS
4 SELECT * FROM (VALUES ('2.2.6', 2, 2, 6))
5 AS "subquery"("string", "major", "minor", "revision");
7 CREATE TABLE "issue_order" (
8 "id" INT8 PRIMARY KEY, --REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
9 "order_in_admission_state" INT4,
10 "order_in_open_states" INT4 );
12 COMMENT ON TABLE "issue_order" IS 'Ordering information for issues that are not stored in the "issue" table to avoid locking of multiple issues at once';
14 COMMENT ON COLUMN "issue_order"."id" IS 'References "issue" ("id") but has no referential integrity trigger associated, due to performance/locking issues';
15 COMMENT ON COLUMN "issue_order"."order_in_admission_state" IS 'To be used for sorting issues within an area, when showing only issues in admission state; NULL values sort last; updated by "lf_update_issue_order"';
16 COMMENT ON COLUMN "issue_order"."order_in_open_states" IS 'To be used for sorting issues within an area, when showing all open issues; NULL values sort last; updated by "lf_update_issue_order"';
18 CREATE VIEW "issue_supporter_in_admission_state" AS
19 SELECT DISTINCT
20 "issue"."area_id",
21 "issue"."id" AS "issue_id",
22 "supporter"."member_id",
23 "direct_interest_snapshot"."weight"
24 FROM "issue"
25 JOIN "supporter" ON "supporter"."issue_id" = "issue"."id"
26 JOIN "direct_interest_snapshot"
27 ON "direct_interest_snapshot"."issue_id" = "issue"."id"
28 AND "direct_interest_snapshot"."event" = "issue"."latest_snapshot_event"
29 AND "direct_interest_snapshot"."member_id" = "supporter"."member_id"
30 WHERE "issue"."state" = 'admission'::"issue_state";
32 COMMENT ON VIEW "issue_supporter_in_admission_state" IS 'Helper view for "lf_update_issue_order" to allow a (proportional) ordering of issues within an area';
34 CREATE VIEW "open_issues_ordered_with_minimum_position" AS
35 SELECT
36 "area_id",
37 "id" AS "issue_id",
38 "order_in_admission_state" * 2 - 1 AS "minimum_position"
39 FROM "issue" NATURAL LEFT JOIN "issue_order"
40 WHERE "closed" ISNULL
41 ORDER BY
42 coalesce(
43 "fully_frozen" + "voting_time",
44 "half_frozen" + "verification_time",
45 "accepted" + "discussion_time",
46 "created" + "admission_time"
47 ) - now();
49 COMMENT ON VIEW "open_issues_ordered_with_minimum_position" IS 'Helper view for "lf_update_issue_order" to allow a (mixed) ordering of issues within an area';
51 COMMIT;

Impressum / About Us