当前位置: 首页>>代码示例>>Python>>正文


Python Tracker.activity_secs方法代码示例

本文整理汇总了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)
    )
开发者ID:kingctan,项目名称:django-oppia,代码行数:35,代码来源:views.py

示例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))
开发者ID:mohideen-openwave,项目名称:django-oppia,代码行数:22,代码来源:views.py

示例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)
开发者ID:mohideen-openwave,项目名称:django-oppia,代码行数:6,代码来源:resources.py


注:本文中的oppia.models.Tracker.activity_secs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。