def award_all_points_for_action(self, action, content_review=False): for activity_log in ActivityLog.objects.filter(action=action.id): user = activity_log.user try: addon = activity_log.arguments[0] version = activity_log.arguments[1] except IndexError: log.error('ActivityLog %d is missing one or more arguments', activity_log.pk) continue # If there is already a score recorded in the database for this # event, with our special note, it means we already processed it # somehow (maybe we ran the script twice...), so ignore it. # Otherwise award the points! event = ReviewerScore.get_event( addon, amo.STATUS_PUBLIC, version=version, post_review=True, content_review=content_review) if not ReviewerScore.objects.filter( user=user, addon=addon, note_key=event, note=MANUAL_NOTE).exists(): ReviewerScore.award_points( user, addon, amo.STATUS_PUBLIC, version=version, post_review=True, content_review=content_review, extra_note=MANUAL_NOTE) else: log.error('Already awarded points for "%s" action on %s %s', action.short, addon, version) continue
def check_event(self, type, status, event, **kwargs): self.addon.type = type assert ReviewerScore.get_event(self.addon, status, **kwargs) == event
def check_event(self, type, status, event, **kwargs): self.addon.type = type eq_(ReviewerScore.get_event(self.addon, status, **kwargs), event, ('Score event for type:%s and status:%s was not %s' % (type, status, event)))
def check_event(self, type, status, event, **kwargs): self.addon.type = type eq_(ReviewerScore.get_event(self.addon, status, **kwargs), event, ( 'Score event for type:%s and status:%s was not %s' % ( type, status, event)))