當前位置: 首頁>>代碼示例>>Python>>正文


Python ReviewerScore.get_event方法代碼示例

本文整理匯總了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
開發者ID:bqbn,項目名稱:addons-server,代碼行數:31,代碼來源:award_post_review_points.py


注:本文中的olympia.reviewers.models.ReviewerScore.get_event方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。