本文整理汇总了Python中olympia.reviewers.models.ReviewerScore.get_event方法的典型用法代码示例。如果您正苦于以下问题:Python ReviewerScore.get_event方法的具体用法?Python ReviewerScore.get_event怎么用?Python ReviewerScore.get_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类olympia.reviewers.models.ReviewerScore
的用法示例。
在下文中一共展示了ReviewerScore.get_event方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: award_all_points_for_action
# 需要导入模块: from olympia.reviewers.models import ReviewerScore [as 别名]
# 或者: from olympia.reviewers.models.ReviewerScore import get_event [as 别名]
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