Thanks for the timely response! ![]()
Here's the error I have!
Job exception: PG::Error: 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, 224, 0) already exists. : INSERT INTO user_badges(badge_id, user_id, granted_at, granted_by_id, post_id) SELECT 104, q.user_id, q.granted_at, -1, NULL FROM ( SELECT p.user_id, p.id post_id, p.updated_at granted_at FROM badge_posts p WHERE p.post_number > 1 AND p.like_count >= 5 AND ('t' OR p.id IN (-2) ) ) q LEFT JOIN user_badges ub ON ub.badge_id = 104 AND ub.user_id = q.user_id WHERE (ub.badge_id IS NULL AND q.user_id <> -1)
RETURNING id, user_id, granted_at</details>