liquid_feedback_core

diff core.sql @ 436:34cc98defa8b

2 bugfixes: Error in core-update.v2.2.6-v3.0.1.sql fixed; Always set "initiative"."first_preference_votes" (also if no votes are found)
author jbe
date Wed Jul 16 16:28:35 2014 +0200 (2014-07-16)
parents 603f6e4bbedf
children eb12a069063c
line diff
     1.1 --- a/core.sql	Fri Jul 11 01:44:25 2014 +0200
     1.2 +++ b/core.sql	Wed Jul 16 16:28:35 2014 +0200
     1.3 @@ -7,7 +7,7 @@
     1.4  BEGIN;
     1.5  
     1.6  CREATE VIEW "liquid_feedback_version" AS
     1.7 -  SELECT * FROM (VALUES ('3.0.2', 3, 0, 2))
     1.8 +  SELECT * FROM (VALUES ('3.0.3', 3, 0, 3))
     1.9    AS "subquery"("string", "major", "minor", "revision");
    1.10  
    1.11  
    1.12 @@ -3806,7 +3806,7 @@
    1.13          WHERE "id" = "issue_id_p";
    1.14        -- calculate "first_preference_votes":
    1.15        UPDATE "initiative"
    1.16 -        SET "first_preference_votes" = coalesce("subquery"."sum", 0)
    1.17 +        SET "first_preference_votes" = "subquery"."sum"
    1.18          FROM (
    1.19            SELECT "vote"."initiative_id", sum("direct_voter"."weight")
    1.20            FROM "vote" JOIN "direct_voter"
    1.21 @@ -3818,6 +3818,10 @@
    1.22          WHERE "initiative"."issue_id" = "issue_id_p"
    1.23          AND "initiative"."admitted"
    1.24          AND "initiative"."id" = "subquery"."initiative_id";
    1.25 +      UPDATE "initiative" SET "first_preference_votes" = 0
    1.26 +        WHERE "issue_id" = "issue_id_p"
    1.27 +        AND "initiative"."admitted"
    1.28 +        AND "first_preference_votes" ISNULL;
    1.29        -- copy "positive_votes" and "negative_votes" from "battle" table:
    1.30        UPDATE "initiative" SET
    1.31          "positive_votes" = "battle_win"."count",

Impressum / About Us