[solved] Badges 'update daily' won't trigger

In my installation of 1.3.0.beta1, Badge that ‘Update daily’ won’t trigger automatically.

SQL:

SELECT u.id AS user_id, MIN(u.created_at + interval '8 day') AS granted_at
      FROM users u
      JOIN posts p ON p.user_id = u.id
     WHERE u.id > 0
       AND u.active
       AND NOT u.blocked
       AND u.created_at + interval '8 day' < now()
       AND p.deleted_at IS NULL
       AND NOT p.hidden
       AND p.created_at + interval '8 day' > now()
       AND (:backfill OR u.id IN (:user_ids))
     GROUP BY u.id
     HAVING COUNT(p.id) > 0

but Preview granted badges | Preview with query plan are working normally.

Badge Query Preview
5 badges to be assigned.

Sample:

… at Feb 21, 2015 8:44 am
… at Feb 21, 2015 12:03 am
… at Feb 20, 2015 9:03 pm
… at Feb 22, 2015 10:40 am
… at Feb 20, 2015 8:52 pm

Settings:
Trigger: Update daily
Allow badge to be used as a title
Show badge on the public badges page
Enable badge

What does /sidekiq/scheduler and /logs show? Is the Jobs::BadgeGrant failing?

2 Likes

/sidekiq/scheduler : Jobs::BadgeGrant FAILED
/logs:
Job exception: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index_user_badges_on_badge_id_and_user_id_and_seq”
DETAIL: Key (badge_id, user_id, seq)=(104, 1, 0) already exists.

Thanks, problem solved (by adding DISTINCT ON for user_id of another badge)

I moved 3 posts to a new topic: Badge grant fails if any throw exception