# HG changeset patch # User jbe # Date 1299521714 -3600 # Node ID 8a1a488a1a67bbac17d7ed6f497f68b7aa55f3e5 # Parent 92fc60ed705d233624d3b955aecf5f182c0be6a7 Bugfix in function "freeze_after_snapshot"; Simplified function "close_voting" Constraint "valid_state" on table "issue" requires, that "ranks_available" is set to true, if state is set to 'canceled_no_initiative_admitted'. Function "close_voting" assumes that there was at least one initiative to be voted on (ensured by "freeze_after_snapshot"). diff -r 92fc60ed705d -r 8a1a488a1a67 core.sql --- a/core.sql Mon Mar 07 14:15:53 2011 +0100 +++ b/core.sql Mon Mar 07 19:15:14 2011 +0100 @@ -3258,11 +3258,12 @@ WHERE "id" = "issue_id_p"; ELSE UPDATE "issue" SET - "state" = 'canceled_no_initiative_admitted', - "accepted" = coalesce("accepted", now()), - "half_frozen" = coalesce("half_frozen", now()), - "fully_frozen" = now(), - "closed" = now() + "state" = 'canceled_no_initiative_admitted', + "accepted" = coalesce("accepted", now()), + "half_frozen" = coalesce("half_frozen", now()), + "fully_frozen" = now(), + "closed" = now(), + "ranks_available" = TRUE WHERE "id" = "issue_id_p"; -- NOTE: The following DELETE statements have effect only when -- issue state has been manipulated @@ -3800,17 +3801,10 @@ -- mark issue as finished UPDATE "issue" SET "state" = - CASE WHEN NOT EXISTS ( - SELECT NULL FROM "initiative" - WHERE "issue_id" = "issue_id_p" AND "admitted" - ) THEN - 'canceled_no_initiative_admitted'::"issue_state" + CASE WHEN "dimension_v" = 0 THEN + 'finished_without_winner'::"issue_state" ELSE - CASE WHEN "dimension_v" = 0 THEN - 'finished_without_winner'::"issue_state" - ELSE - 'finished_with_winner'::"issue_state" - END + 'finished_with_winner'::"issue_state" END, "ranks_available" = TRUE WHERE "id" = "issue_id_p"; diff -r 92fc60ed705d -r 8a1a488a1a67 update/core-update.v1.3.1-v1.4.0_rc1.sql --- a/update/core-update.v1.3.1-v1.4.0_rc1.sql Mon Mar 07 14:15:53 2011 +0100 +++ b/update/core-update.v1.3.1-v1.4.0_rc1.sql Mon Mar 07 19:15:14 2011 +0100 @@ -1238,11 +1238,12 @@ WHERE "id" = "issue_id_p"; ELSE UPDATE "issue" SET - "state" = 'canceled_no_initiative_admitted', - "accepted" = coalesce("accepted", now()), - "half_frozen" = coalesce("half_frozen", now()), - "fully_frozen" = now(), - "closed" = now() + "state" = 'canceled_no_initiative_admitted', + "accepted" = coalesce("accepted", now()), + "half_frozen" = coalesce("half_frozen", now()), + "fully_frozen" = now(), + "closed" = now(), + "ranks_available" = TRUE WHERE "id" = "issue_id_p"; -- NOTE: The following DELETE statements have effect only when -- issue state has been manipulated @@ -1575,17 +1576,10 @@ -- mark issue as finished UPDATE "issue" SET "state" = - CASE WHEN NOT EXISTS ( - SELECT NULL FROM "initiative" - WHERE "issue_id" = "issue_id_p" AND "admitted" - ) THEN - 'canceled_no_initiative_admitted'::"issue_state" + CASE WHEN "dimension_v" = 0 THEN + 'finished_without_winner'::"issue_state" ELSE - CASE WHEN "dimension_v" = 0 THEN - 'finished_without_winner'::"issue_state" - ELSE - 'finished_with_winner'::"issue_state" - END + 'finished_with_winner'::"issue_state" END, "ranks_available" = TRUE WHERE "id" = "issue_id_p";