liquid_feedback_core
changeset 96:07e6a4f11b5b
Removed unneccessary JOIN in "create_interest_snapshot"(...)
The INSERT INTO "direct_supporter_snapshot" in function "create_interest_snapshot"(...) does not need to check if members are active.
The previous step ensures that the joined table "direct_interest_snapshot" does not contain entries from disabled members.
The INSERT INTO "direct_supporter_snapshot" in function "create_interest_snapshot"(...) does not need to check if members are active.
The previous step ensures that the joined table "direct_interest_snapshot" does not contain entries from disabled members.
author | jbe |
---|---|
date | Mon Dec 06 23:50:32 2010 +0100 (2010-12-06) |
parents | 625f88e41125 |
children | 58451b5565ae 46260129d0ce |
files | core.sql |
line diff
1.1 --- a/core.sql Mon Nov 08 01:46:58 2010 +0100 1.2 +++ b/core.sql Mon Dec 06 23:50:32 2010 +0100 1.3 @@ -2313,29 +2313,26 @@ 1.4 ( "issue_id", "initiative_id", "event", "member_id", 1.5 "informed", "satisfied" ) 1.6 SELECT 1.7 - "issue_id_p" AS "issue_id", 1.8 - "initiative"."id" AS "initiative_id", 1.9 - 'periodic' AS "event", 1.10 - "member"."id" AS "member_id", 1.11 + "issue_id_p" AS "issue_id", 1.12 + "initiative"."id" AS "initiative_id", 1.13 + 'periodic' AS "event", 1.14 + "supporter"."member_id" AS "member_id", 1.15 "supporter"."draft_id" = "current_draft"."id" AS "informed", 1.16 NOT EXISTS ( 1.17 SELECT NULL FROM "critical_opinion" 1.18 WHERE "initiative_id" = "initiative"."id" 1.19 - AND "member_id" = "member"."id" 1.20 + AND "member_id" = "supporter"."member_id" 1.21 ) AS "satisfied" 1.22 - FROM "supporter" 1.23 - JOIN "member" 1.24 - ON "supporter"."member_id" = "member"."id" 1.25 - JOIN "initiative" 1.26 + FROM "initiative" 1.27 + JOIN "supporter" 1.28 ON "supporter"."initiative_id" = "initiative"."id" 1.29 JOIN "current_draft" 1.30 ON "initiative"."id" = "current_draft"."initiative_id" 1.31 JOIN "direct_interest_snapshot" 1.32 - ON "member"."id" = "direct_interest_snapshot"."member_id" 1.33 + ON "supporter"."member_id" = "direct_interest_snapshot"."member_id" 1.34 AND "initiative"."issue_id" = "direct_interest_snapshot"."issue_id" 1.35 AND "event" = 'periodic' 1.36 - WHERE "member"."active" 1.37 - AND "initiative"."issue_id" = "issue_id_p"; 1.38 + WHERE "initiative"."issue_id" = "issue_id_p"; 1.39 RETURN; 1.40 END; 1.41 $$;