liquid_feedback_core
changeset 409:5f24058af0b8
Secondary sorting key for issues in admission phase
author | jbe |
---|---|
date | Mon Oct 14 00:58:38 2013 +0200 (2013-10-14) |
parents | f7b4457cf1a6 |
children | d301dc24b25c |
files | core.sql lf_update_issue_order.c update/core-update.v2.2.5-v2.2.6.sql |
line diff
1.1 --- a/core.sql Mon Oct 14 00:23:04 2013 +0200 1.2 +++ b/core.sql Mon Oct 14 00:58:38 2013 +0200 1.3 @@ -608,12 +608,14 @@ 1.4 1.5 CREATE TABLE "issue_order" ( 1.6 "id" INT8 PRIMARY KEY, --REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 1.7 - "order_in_admission_state" INT4 ); 1.8 + "order_in_admission_state" INT4, 1.9 + "max_supporter_count" INT4 ); 1.10 1.11 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'; 1.12 1.13 COMMENT ON COLUMN "issue_order"."id" IS 'References "issue" ("id") but has no referential integrity trigger associated, due to performance/locking issues'; 1.14 COMMENT ON COLUMN "issue_order"."order_in_admission_state" IS 'To be used for sorting issues within an area, when showing issues in admission state; NULL values sort last; updated by "lf_update_issue_order"'; 1.15 +COMMENT ON COLUMN "issue_order"."max_supporter_count" IS 'Secondary sorting key when displaying issues in admission state from different areas'; 1.16 1.17 1.18 CREATE TABLE "issue_setting" (
2.1 --- a/lf_update_issue_order.c Mon Oct 14 00:23:04 2013 +0200 2.2 +++ b/lf_update_issue_order.c Mon Oct 14 00:58:38 2013 +0200 2.3 @@ -204,7 +204,7 @@ 2.4 fprintf(stderr, "Could not escape literal in memory.\n"); 2.5 abort(); 2.6 } 2.7 - if (asprintf(&cmd, "INSERT INTO \"issue_order\" (\"id\", \"order_in_admission_state\") VALUES (%s, %i)", escaped_issue_id, candidates[i].seat) < 0) { 2.8 + if (asprintf(&cmd, "INSERT INTO \"issue_order\" (\"id\", \"order_in_admission_state\", \"max_supporter_count\") SELECT %s, %i, max(\"supporter_count\") FROM \"initiative\" WHERE \"issue_id\" = %s", escaped_issue_id, candidates[i].seat, escaped_issue_id) < 0) { 2.9 fprintf(stderr, "Could not prepare query string in memory.\n"); 2.10 abort(); 2.11 }
3.1 --- a/update/core-update.v2.2.5-v2.2.6.sql Mon Oct 14 00:23:04 2013 +0200 3.2 +++ b/update/core-update.v2.2.5-v2.2.6.sql Mon Oct 14 00:58:38 2013 +0200 3.3 @@ -6,12 +6,14 @@ 3.4 3.5 CREATE TABLE "issue_order" ( 3.6 "id" INT8 PRIMARY KEY, --REFERENCES "issue" ("id") ON DELETE CASCADE ON UPDATE CASCADE, 3.7 - "order_in_admission_state" INT4 ); 3.8 + "order_in_admission_state" INT4, 3.9 + "max_supporter_count" INT4 ); 3.10 3.11 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'; 3.12 3.13 COMMENT ON COLUMN "issue_order"."id" IS 'References "issue" ("id") but has no referential integrity trigger associated, due to performance/locking issues'; 3.14 COMMENT ON COLUMN "issue_order"."order_in_admission_state" IS 'To be used for sorting issues within an area, when showing issues in admission state; NULL values sort last; updated by "lf_update_issue_order"'; 3.15 +COMMENT ON COLUMN "issue_order"."max_supporter_count" IS 'Secondary sorting key when displaying issues in admission state from different areas'; 3.16 3.17 CREATE VIEW "issue_supporter_in_admission_state" AS 3.18 SELECT DISTINCT