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

(Jebwiz Oscar) #1

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


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.


… 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

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

(Kane York) #2

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

(Jebwiz Oscar) #3

/sidekiq/scheduler : Jobs::BadgeGrant FAILED
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)

Badge grant fails if any throw exception
(Régis Hanol) #4

(Kane York) #5

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