how to award newly implemented badge to existing users

asked 2014-03-23 15:11:52 -0600

SocialQA gravatar image

updated 2014-03-24 19:35:05 -0600

Evgeny gravatar image

I have introduced two new badges and I have used the award_badges_signal method in def user_receive_reputation method to trigger these badges. The condition of these badges are very simple when user reach 10 karma points award a badge and when user reach 25 karma points award another badge.

Everything works fine but the problem is that old users who join the the system prior to implementing this button and have satisfy the condition will not get the badge until they get a new karma points. How can I award these badges to existing users who have reach the threshold.

Here is how I am awarding at the moment:

def user_receive_reputation(self, num_points, timestamp=None):
    new_points = self.reputation + num_points
    if new_points > 0:
        self.reputation = new_points
        self.reputation = const.MIN_REPUTATION
    if timestamp is None:
        timestamp =
    if self.reputation > 10:        
            event = 'reach_10_karma',
            actor = self,
            context_object = self,
            timestamp = timestamp
    if self.reputation > 25:
            event = 'reach_25_karma',
            actor = self,
            context_object = self,
            timestamp = timestamp

It would be a great help if someone could provide some help on this.

edit retag flag offensive close merge delete



I think it's better to have signal karma_changed and in the handler specify the points.

Evgeny gravatar imageEvgeny ( 2014-03-23 15:14:54 -0600 )edit

@Evgeny could you provide an example?

SocialQA gravatar imageSocialQA ( 2014-03-23 15:20:14 -0600 )edit

I have notice help is really hard to come by from askbot developers. Are we required to pay to get answers for the questions if so how?

SocialQA gravatar imageSocialQA ( 2014-03-23 15:32:14 -0600 )edit