本文整理汇总了Python中mkt.reviewers.models.ReviewerScore.get_performance_since方法的典型用法代码示例。如果您正苦于以下问题:Python ReviewerScore.get_performance_since方法的具体用法?Python ReviewerScore.get_performance_since怎么用?Python ReviewerScore.get_performance_since使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.reviewers.models.ReviewerScore
的用法示例。
在下文中一共展示了ReviewerScore.get_performance_since方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_performance_since
# 需要导入模块: from mkt.reviewers.models import ReviewerScore [as 别名]
# 或者: from mkt.reviewers.models.ReviewerScore import get_performance_since [as 别名]
def test_get_performance_since(self):
self._give_points()
ReviewerScore.award_moderation_points(self.user, self.app, 1)
rs = list(ReviewerScore.objects.all())
rs[0].update(created=self.days_ago(50))
performance = ReviewerScore.get_performance_since(self.user, self.days_ago(30))
eq_(len(performance), 1)
示例2: performance
# 需要导入模块: from mkt.reviewers.models import ReviewerScore [as 别名]
# 或者: from mkt.reviewers.models.ReviewerScore import get_performance_since [as 别名]
def performance(request, email=None):
is_admin = acl.action_allowed(request, 'Admin', '%')
if email:
if email == request.user.email:
user = request.user
elif is_admin:
user = get_object_or_404(UserProfile, email=email)
else:
raise http.Http404
else:
user = request.user
today = datetime.date.today()
month_ago = today - datetime.timedelta(days=30)
year_ago = today - datetime.timedelta(days=365)
total = ReviewerScore.get_total(user)
totals = ReviewerScore.get_performance(user)
months = ReviewerScore.get_performance_since(user, month_ago)
years = ReviewerScore.get_performance_since(user, year_ago)
def _sum(iter):
return sum(s.total or 0 for s in iter)
performance = {
'month': _sum(months),
'year': _sum(years),
'total': _sum(totals),
}
ctx = context(request, **{
'profile': user,
'total': total,
'performance': performance,
})
return render(request, 'reviewers/performance.html', ctx)