# HG changeset patch # User jbe # Date 1336840436 -7200 # Node ID 05eb08f56f09cbb014e8c0d5494d5c2cdcddfe1a # Parent 4b8cc6fc2d0051d62a3b9dbc13c7658161b5b29c Bugfix in view "unit_member_count" diff -r 4b8cc6fc2d00 -r 05eb08f56f09 core.sql --- a/core.sql Fri May 11 17:08:55 2012 +0200 +++ b/core.sql Sat May 12 18:33:56 2012 +0200 @@ -1888,7 +1888,7 @@ CREATE VIEW "unit_member_count" AS SELECT "unit"."id" AS "unit_id", - sum("member"."id") AS "member_count" + count("member"."id") AS "member_count" FROM "unit" LEFT JOIN "privilege" ON "privilege"."unit_id" = "unit"."id" diff -r 4b8cc6fc2d00 -r 05eb08f56f09 update/core-update.v2.0.8-v2.0.9.sql --- a/update/core-update.v2.0.8-v2.0.9.sql Fri May 11 17:08:55 2012 +0200 +++ b/update/core-update.v2.0.8-v2.0.9.sql Sat May 12 18:33:56 2012 +0200 @@ -4,6 +4,19 @@ SELECT * FROM (VALUES ('2.0.9', 2, 0, 9)) AS "subquery"("string", "major", "minor", "revision"); +CREATE OR REPLACE VIEW "unit_member_count" AS + SELECT + "unit"."id" AS "unit_id", + count("member"."id") AS "member_count" + FROM "unit" + LEFT JOIN "privilege" + ON "privilege"."unit_id" = "unit"."id" + AND "privilege"."voting_right" + LEFT JOIN "member" + ON "member"."id" = "privilege"."member_id" + AND "member"."active" + GROUP BY "unit"."id"; + COMMENT ON TYPE "delegation_chain_row" IS 'Type of rows returned by "delegation_chain" function'; CREATE FUNCTION "delegation_chain_for_closed_issue"