Can SQL granting a badge revoke a different badge?

badge

(Michael Downey) #1

Scenario:

  • Have a set of badges called “Foo Level 1”, “Foo Level 2”, and “Foo Level 3”.
  • Each of the 3 badges are automatically granted when some series of things have occurred thanks to SQL queries.
  • A user can’t be a “Foo Level 2” until after they have earned “Foo Level 1”. In other words, they are a sequence.

What I’d like to do:

  • When “Foo Level 2” is earned, revoke the “Foo Level 1” badge.

Is this possible? If so any advice on how to do it?


#2

Hmm, I see a “Run revocation script daily” in the default badge’s options. May be related to this.


(Michael Downey) #3

Yes, that is a thing, but the revocation (AFAIK) is looking to somehow see if the grant criteria are no longer met. I’d prefer the “Level 1” badge to be revoked at the same time the “Level 2” badge is granted, if possible.

As a workaround, perhaps if there is some SQL to also check to see if another badge is not granted for that user could be used along with this daily revocation process?


(Jens Maier) #4

I’m not sure that revoking the badge is the right thing to do here. The common understanding is that badges that come in levels are transitive: if a user satisfies the requirements to earn badge level N+1, they are assumed to also fulfill the requirements for level N.

Instead, a badge should be able to supersede another badge, creating from the client’s perspective a single badge that comes in several different levels.


(Michael Downey) #5

That makes a badge listing of Level “N” filled with a lot of superfluous data if X% of the people there have also achieved something higher…


(Jens Maier) #6

Well, not necessarily. A frontend-listing of users with “Badge N” doesn’t have to include users with “Badge N+1” if that’s part of the “N+1 supersedes N” contract. :smiley:


(Kane York) #7

This is doable, but I think we need specifics about what the criteria are to help you.

Keep in mind that both schemes are doable and available.

Pictured below, the top & bottom are given only to people in that specific bucket, but the middle is never revoked, you can only add on the higher “attendance streaks”.