Previewed Badges not Awarding

badge

#1

The badge system has been a big hit on our forums, but I’ve encountered a small issue. I’ll admit, I’m not the most savvy and my permissions for the forums end forum-side as an administrator.

There are a couple of badges that I can “preview granted badges” perfectly well (and it shows a healthy list of users) but it doesn’t award those badges. I also made sure I had update daily selected! My guess is that the query is snagging somewhere, but everything I’ve learned is from Discourse meta! I’ve tried to read up on other issues on Discourse meta, but none of them seem to solve my problem (or they do and I’m failing to interpret that they’re the solution :stuck_out_tongue:)


(Sam Saffron) #2

When you go to SITENAME/sidekiq/scheduler you can kick off the daily task, Jobs::BadgeGrant

Kick it off, wait till it finishes, then go to SITENAME/logs to see if you have any errors.


#3

Thanks for the timely response! :slight_smile:

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>

(Sam Saffron) #4

Looks to me like you forgot to tick “Query targets posts” on badge 104


#5

You’re absolutely right, thank you so much, everything is working wonderfully now! :smiley:


(Régis Hanol) #6