Badge notifications not being sent for newly created badges that are retroactive?


(Dean Taylor) #1

Having a look at my badges here on meta…
… there are some here I don’t believe I have never received a notification for.

I thought the whole idea for badges was to enforce good behaviour so would think I would get notifications.

The ones highlighted I really can’t remember receiving ever, there are others too - but these are ones these can be quite sure of.

I can’t see any badge notifications - in my notifications - but I’m not sure I should see them there:


(Sam Saffron) #2

Anniversary was just changed to silver so new installs will get it, there is some notification suppression logic see:

So its legit that you are not being notified for that.

The sharing badge may need a tweak, its grabbing min(id) instead of max which means it is unlikely to hit the threshold

    SELECT views.user_id, i2.post_id, i2.created_at granted_at
    FROM
    (
      SELECT i.user_id, MIN(i.id) i_id
      FROM incoming_links i
      JOIN badge_posts p on p.id = i.post_id
      WHERE i.user_id IS NOT NULL
      GROUP BY i.user_id,i.post_id
      HAVING COUNT(*) > 25
    ) as views
    JOIN incoming_links i2 ON i2.id = views.i_id

(Dean Taylor) #3

How will the Anniversary Badge be handled for forums that are 11+ years old?
11 notifications the first time the badge runs?


(Sam Saffron) #4

at the moment its a once off badge, eventually we want to get a badge ber year but the query needs some careful planning


(Kane York) #5

One possibility would be to add another return column to the badge queries, call it repeat_id. Could be trivially mapped to the seq column in the badge_users table. Then have repeat_id * TIMESPAN('1 year') somewhere in the query.


(Sam Saffron) #6

my concern is around the 1 post per year req check, for each user you need to break it down to an artificial set with year-start / year-end and then join to that. it can get to be an expensive query.


(Dean Taylor) #7

Just checking out badges again…

I feel like I’ve missed some notifications here again…

If you compare the following graphic with the one in my first post - I don’t believe I have received notifications for the red arrowed ones:


(Kane York) #8

That’s probably because they’re bronze badges, and they got backdated past the notification cutoff date… we should either nix that notification cutoff or fix the badges


(Sam Saffron) #9

Not sure about that, it will probably end up being notification central if we do that.

We need a proper strategy of dealing with badge floods before doing any of that.


(Dean Taylor) #10

Again just to mention I don’t believe I received notifications for the following:

  • 20 Nice Share badges
  • 3 popular link badges

(I might have received notifications for 1 or 2 - but not 20+)

More recently I have been receiving notifications for new “Bug Reporter” badges.


(Kane York) #11

Again, the granted_at field for those badges is broken… they are “awarded” “on” the date of the post, not the date of the Nth share.


(Dean Taylor) #12

“broken” - thanks for the clarification - this I understand.


(Sam Saffron) #13

Technically Nth share is a nightmare wrapped in 3 other nightmares to calculate, but we could simple set granted at for these badges to “now”


(Sam Saffron) #14

Fixed per:


(Sam Saffron) #15