Best Approach for Designing a Framework for an Icon Assignment System

I am currently developing one educational site.

To do this, we need to assign some icons to the user based on their activity (e.g. stackoverflow).

I was looking for a framework for this. Does anyone have an idea how to do this? Table design etc.

The questions I could think of are as follows:

  • We can have a large number of icons, so with every user action we can’t check all the icons and check if any icon can be assigned.
  • When adding a new icon and criteria for this, I do not want to change the existing code to process it (can there be some general solution?)
  • Which db should I choose (let's say if my framework is similar, it raises an event when the criteria for one icon satisfies and these rules are created in the DB (for example sql). Or I can go for nosql db (for example, mongodb as my rest the project is in mongodb)

My initial search gave me the following things

+7
source share
1 answer

I would choose a relational database for the nosql database for this approach.

The first thing you need is the basic structure of the icon.

ID (int) Title (Varchar 255) Image (Varchar 255) - would hold location to image Points (int) 

Then you will need to save all the badges that the user earned. Therefore, in the "Users" section:

 Badges (Varchar) - holds a serialized array of badge IDs Badge_count (int) - So you can get the total without parsing through Badges. Point_count (int) 

Now you say that you cannot request all the icons for each action performed, so you should also keep a record for each action. So say in the "posts" table, for example:

 Possible_badges (Varchar 255) - serialized array of Badge ID's 

Then you can normalize and provide only your icons associated with a specific task in your rules engine.

It’s best to start playing with them if you don’t understand what it is, what you have to compromise and go for the basic logic, so only award badges for tasks that can be measured by database records (mostly numerical data). Or spend more time training (and pulling hair).

+1
source

All Articles