本文整理汇总了Python中oppia.models.Points.page_points方法的典型用法代码示例。如果您正苦于以下问题:Python Points.page_points方法的具体用法?Python Points.page_points怎么用?Python Points.page_points使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oppia.models.Points
的用法示例。
在下文中一共展示了Points.page_points方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scorecard_view
# 需要导入模块: from oppia.models import Points [as 别名]
# 或者: from oppia.models.Points import page_points [as 别名]
def scorecard_view(request):
auth = ApiKeyAuthentication()
if auth.is_authenticated(request) is not True:
return HttpResponse("Unauthorized", status=401)
record_mobile_tracker(request, None, "scorecard", '{"en":"homepage"}')
start_date = datetime.datetime.now() - datetime.timedelta(days=14)
end_date = datetime.datetime.now()
media = {
"views": Tracker.activity_views(user=request.user, type="media", start_date=start_date, end_date=end_date),
"secs": Tracker.activity_secs(user=request.user, type="media", start_date=start_date, end_date=end_date),
"points": Points.media_points(user=request.user, start_date=start_date, end_date=end_date),
}
quiz = {
"views": Tracker.activity_views(user=request.user, type="quiz", start_date=start_date, end_date=end_date),
"secs": Tracker.activity_secs(user=request.user, type="quiz", start_date=start_date, end_date=end_date),
"points": Points.quiz_points(user=request.user, start_date=start_date, end_date=end_date),
}
acts = {
"views": Tracker.activity_views(user=request.user, type="page", start_date=start_date, end_date=end_date),
"secs": Tracker.activity_secs(user=request.user, type="page", start_date=start_date, end_date=end_date),
"points": Points.page_points(user=request.user, start_date=start_date, end_date=end_date),
}
total = {
"views": acts["views"] + quiz["views"] + media["views"],
"secs": acts["secs"] + quiz["secs"] + media["secs"],
"points": acts["points"] + quiz["points"] + media["points"],
}
scorecard = {"media": media, "quiz": quiz, "acts": acts, "total": total}
return render_to_response(
"oppia/mobile/scorecard.html", {"scorecard": scorecard}, context_instance=RequestContext(request)
)
示例2: scorecard_view
# 需要导入模块: from oppia.models import Points [as 别名]
# 或者: from oppia.models.Points import page_points [as 别名]
def scorecard_view(request):
auth = ApiKeyAuthentication()
if auth.is_authenticated(request) is not True:
return HttpResponse('Unauthorized', status=401)
start_date = datetime.datetime.now() - datetime.timedelta(days=14)
end_date = datetime.datetime.now()
media = {'views':Tracker.activity_views(user=request.user,type='media',start_date=start_date,end_date=end_date),
'secs':Tracker.activity_secs(user=request.user,type='media',start_date=start_date,end_date=end_date),
'points':Points.media_points(user=request.user,start_date=start_date,end_date=end_date)}
quiz = {'views':Tracker.activity_views(user=request.user,type='quiz',start_date=start_date,end_date=end_date),
'secs':Tracker.activity_secs(user=request.user,type='quiz',start_date=start_date,end_date=end_date),
'points':Points.quiz_points(user=request.user,start_date=start_date,end_date=end_date)}
acts = {'views':Tracker.activity_views(user=request.user,type='page',start_date=start_date,end_date=end_date),
'secs':Tracker.activity_secs(user=request.user,type='page',start_date=start_date,end_date=end_date),
'points':Points.page_points(user=request.user,start_date=start_date,end_date=end_date)}
total = {'views':acts['views'] + quiz['views'] + media['views'],
'secs': acts['secs'] + quiz['secs'] + media['secs'],
'points': acts['points'] + quiz['points'] + media['points'],}
scorecard = {'media':media, 'quiz':quiz, 'acts':acts, 'total': total}
return render_to_response('oppia/mobile/scorecard.html',{ 'scorecard':scorecard }, context_instance=RequestContext(request))
示例3: dehydrate_page_points
# 需要导入模块: from oppia.models import Points [as 别名]
# 或者: from oppia.models.Points import page_points [as 别名]
def dehydrate_page_points(self,bundle):
start_date = datetime.datetime.now() - datetime.timedelta(days=14)
end_date = datetime.datetime.now()
return Points.page_points(user=bundle.obj,start_date=start_date,end_date=end_date)