Skip unchanged users for badge mass edit

Currently, mass editing badges while removing them from previous holders results in people getting a badge removed and immediately regranted, if they are in the intersection of previous and future holders.

This results in a confusing user experience, as users receive a notification about receiving the badge even though nothing has changed.

Also, it clashes with one of our use cases: We would like to drop obsolete badges and award new ones by passing the updated list of holders, while keeping the other holders and the date of awarding unchanged.

Feature-wise, change would be is a strict improvement: By uploading an empty list first, the old behavior is recovered.

1 Like

By “passing the updated list” and “uploading an empty list”, it sounds like you’re working in the rails console, maybe with a list of users.id ?

If that’s the case, could it help to get the list of current badge holders so you could exclude them from your drop/award operations?

(Data explorer query)
-- [params]
-- badge_id :badge

SELECT
    u.id AS user_id
FROM user_badges ub
JOIN users u  ON u.id = ub.user_id
JOIN badges b ON b.id = ub.badge_id
WHERE ub.badge_id = :badge

With that exported list, maybe some queries and scripts could:

  1. Find the intersection of current badge holders & your “future holders” list.
  2. Remove those intersection users from your “future holders” list.
  3. Revoke badge from any users not in the intersection.
  4. Upload the edited “future holders” list to award badge to new holders only.

(There might even be a way to do it all within rails, but I’m not strong there.)

No? There is a mass award form in the badge management UX, which I am using.

Oof, that’s a little embarassing, I’d missed the bulk award addition.

Maybe your feature would be another option at upload, something along these lines?

1 Like