liquid_feedback_core

changeset 105:6bf35cfa3ba8

Exceptional updating of "last_login_public" in case of account reactivation
author jbe
date Sat Feb 05 16:06:19 2011 +0100 (2011-02-05)
parents 0d03c57ebae5
children 4d121276bf04
files core.sql
line diff
     1.1 --- a/core.sql	Mon Jan 24 17:30:18 2011 +0100
     1.2 +++ b/core.sql	Sat Feb 05 16:06:19 2011 +0100
     1.3 @@ -2064,7 +2064,16 @@
     1.4        SELECT * INTO "system_setting_row" FROM "system_setting";
     1.5        LOCK TABLE "member" IN SHARE ROW EXCLUSIVE MODE;
     1.6        UPDATE "member" SET "last_login_public" = "last_login"::date
     1.7 -        WHERE "last_login"::date < 'today';
     1.8 +        FROM (
     1.9 +          SELECT DISTINCT "member"."id"
    1.10 +          FROM "member" LEFT JOIN "member_history"
    1.11 +          ON "member"."id" = "member_history"."member_id"
    1.12 +          WHERE "member"."last_login"::date < 'today' OR (
    1.13 +            "member_history"."until"::date >= 'today' AND
    1.14 +            "member_history"."active" = FALSE AND "member"."active" = TRUE
    1.15 +          )
    1.16 +        ) AS "subquery"
    1.17 +        WHERE "member"."id" = "subquery"."id";
    1.18        IF "system_setting_row"."member_ttl" NOTNULL THEN
    1.19          UPDATE "member" SET "active" = FALSE
    1.20            WHERE "active" = TRUE
    1.21 @@ -2075,7 +2084,7 @@
    1.22      END;
    1.23    $$;
    1.24  
    1.25 -COMMENT ON FUNCTION "check_last_login"() IS 'Updates "last_login_public" field, which contains the date but not the time of the last login, and deactivates members who do not login for the time specified in "system_setting"."member_ttl". For privacy reasons this function does not update "last_login_public", if the last login of a member has been today.';
    1.26 +COMMENT ON FUNCTION "check_last_login"() IS 'Updates "last_login_public" field, which contains the date but not the time of the last login, and deactivates members who do not login for the time specified in "system_setting"."member_ttl". For privacy reasons this function does not update "last_login_public", if the last login of a member has been today (except when member was reactivated today).';
    1.27  
    1.28  
    1.29  CREATE FUNCTION "calculate_member_counts"()

Impressum / About Us