本文整理匯總了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