本文整理汇总了Python中oppia.models.Tracker.activity_secs方法的典型用法代码示例。如果您正苦于以下问题:Python Tracker.activity_secs方法的具体用法?Python Tracker.activity_secs怎么用?Python Tracker.activity_secs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oppia.models.Tracker
的用法示例。
在下文中一共展示了Tracker.activity_secs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: scorecard_view
# 需要导入模块: from oppia.models import Tracker [as 别名]
# 或者: from oppia.models.Tracker import activity_secs [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 Tracker [as 别名]
# 或者: from oppia.models.Tracker import activity_secs [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_quiz_secs
# 需要导入模块: from oppia.models import Tracker [as 别名]
# 或者: from oppia.models.Tracker import activity_secs [as 别名]
def dehydrate_quiz_secs(self,bundle):
start_date = datetime.datetime.now() - datetime.timedelta(days=14)
end_date = datetime.datetime.now()
return Tracker.activity_secs(user=bundle.obj,type='quiz',start_date=start_date,end_date=end_date)