Best way to save Badge criteria?

I was thinking about how to implement an icon feature similar to SO on a new website. What is the best way to store criteria for icons?

Two ideas:

  • Whole code
  • The "second system" is to create a meta-architecture for identifying icons and their criteria. Store some information in the database and request a code to identify the icons and their criteria.

Are there any better ways?

+33
architecture badge
Feb 07 '09 at 1:53
source share
2 answers

Rules.

You create events in the system and use the rules in the event flow processor.

In particular, let's say you have a 10 posts made icon. You do not run "select count (*) from messages, where user =: user" for each message. Rather, you have a simple rule that monitors each message and "counts" by storing the rules in the user profile.

Thus, “made 10 posts” are as cheap as “made 1,000,000” posts.

It also makes the system much more extensible.

+37
Feb 07 '09 at 2:01
source share

I agree with Will on this.

Create "events" over the pages, so every time an event occurs, i.e. the user deletes the message, he will request the event module with the event, say EVENT_USER_DELETE_POST, and then you can select this event and build a request on it. You can then decide whether the badge is awarded or not.

This will keep the two logic separate and keep the modular design. It should be very easy to implement this way.

The only drawback is that if the event was not “captured”, then the user may have earned the criteria for skipping, but he has not yet been rewarded. However, this should never happen. The only situation I can think of is to manually manipulate the database.

+18
Feb 07 '09 at 2:08
source share



All Articles