Menu

Badges without counters: awarding achievements from data we already had
📰

Badges without counters: awarding achievements from data we already had

DEV Community: database·Miles Corran·about 15 hours ago
#o5Vk5X2O
#devtodatabase#devto#dev#badges#badge
Reading 0:00
15s threshold

Braineos now has badges: eight on Braineos, each with up to four tiers from Bronze to Platinum, a trophy case on every profile and a share card for each one. The same code runs CertBrain and Finance Brain, so the design had to work for three sites with different ideas of what is worth rewarding. Three decisions shaped it.

Definitions live in code, chosen per site

The catalog is one TypeScript file. Each badge has an id, its tiers, the events that can change it, and a progress() function that returns a number:

{ id : "streak" , kind : "tiered" , tiers : [ 7 , 30 , 100 , 365 ] , events : [ "attempt_recorded" ] , progress : ( ctx ) => ctx . currentStreak ( ) , }

Enter fullscreen mode

Exit fullscreen mode

Each site’s profile lists the badges it uses. Braineos has Tower Defense, deck creation and “studied by others”. CertBrain’s list, not switched on yet, swaps those for course and practice-readiness badges.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.