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


Python Points.page_points方法代码示例

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

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

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


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