do not try awarding disabled badges to users
This commit is contained in:
parent
c418142386
commit
dcb35a97cb
|
@ -3252,6 +3252,11 @@ def record_award_event(instance, created, **kwargs):
|
|||
We also recaculate awarded_count of this badge and user information.
|
||||
"""
|
||||
if created:
|
||||
try:
|
||||
badge = get_badge(instance.badge.slug)
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
#todo: change this to community user who gives the award
|
||||
activity = Activity(
|
||||
user=instance.user,
|
||||
|
@ -3265,8 +3270,6 @@ def record_award_event(instance, created, **kwargs):
|
|||
instance.badge.awarded_count += 1
|
||||
instance.badge.save()
|
||||
|
||||
badge = get_badge(instance.badge.slug)
|
||||
|
||||
if badge.level == const.GOLD_BADGE:
|
||||
instance.user.gold += 1
|
||||
if badge.level == const.SILVER_BADGE:
|
||||
|
|
Reference in New Issue