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


Python Elaboration.get_review_candidate方法代码示例

本文整理汇总了Python中Elaboration.models.Elaboration.get_review_candidate方法的典型用法代码示例。如果您正苦于以下问题:Python Elaboration.get_review_candidate方法的具体用法?Python Elaboration.get_review_candidate怎么用?Python Elaboration.get_review_candidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Elaboration.models.Elaboration的用法示例。


在下文中一共展示了Elaboration.get_review_candidate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_context_review

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_review_candidate [as 别名]
def create_context_review(request):
    data = {}
    if "id" in request.GET:
        user = RequestContext(request)["user"]
        challenge = Challenge.objects.get(pk=request.GET.get("id"))
        if not challenge.is_enabled_for_user(user):
            raise Http404
        if challenge.has_enough_user_reviews(user):
            raise Http404
        if not challenge.submitted_by_user(user):
            raise Http404
        review = Review.get_open_review(challenge, user)
        if not review:
            # number of hours needed to pass until elaboration is applicable as candidate
            offset = randint(ReviewConfig.get_candidate_offset_min(), ReviewConfig.get_candidate_offset_max())
            review_candidate = Elaboration.get_review_candidate(challenge, user, offset)
            if review_candidate:
                review = Review(elaboration=review_candidate, reviewer=user)
                review.save()
            else:
                return data
        data["review"] = review
        data["stack_id"] = challenge.get_stack().id
        review_questions = ReviewQuestion.objects.filter(challenge=challenge).order_by("order")
        data["questions"] = review_questions
    return data
开发者ID:flozzone,项目名称:aurora,代码行数:28,代码来源:views.py

示例2: create_context_review

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_review_candidate [as 别名]
def create_context_review(request):
    data = {}
    if 'id' in request.GET:
        user = request.user
        challenge = Challenge.objects.get(pk=request.GET.get('id'))
        if not challenge.is_enabled_for_user(user):
            raise Http404
        if challenge.has_enough_user_reviews(user):
            raise Http404
        if not challenge.submitted_by_user(user):
            raise Http404
        review = Review.get_open_review(challenge, user)
        if not review:
            review_candidate = Elaboration.get_review_candidate(challenge, user)
            if review_candidate:
                review = Review(elaboration=review_candidate['candidate'], reviewer=user, chosen_by=review_candidate['chosen_by'])
                review.save()
            else:
                return data
        data['review'] = review
        data['stack_id'] = challenge.get_stack().id
        review_questions = ReviewQuestion.objects.filter(challenge=challenge).order_by("order")

        author_questions = [question for question in review_questions if question.visible_to_author == True]
        staff_questions  = [question for question in review_questions if question.visible_to_author == False]

        data['questions'] = review_questions
        data['author_questions'] = author_questions
        data['staff_questions'] = staff_questions

        extra_review_question_present = len(review.elaboration.extra_review_question) > 0
        data['extra_review_question_present'] = extra_review_question_present


    return data
开发者ID:martflu,项目名称:aurora,代码行数:37,代码来源:views.py

示例3: create_context_review

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_review_candidate [as 别名]
def create_context_review(request):
    data = {}
    if 'id' in request.GET:
        user = request.user
        challenge = Challenge.objects.get(pk=request.GET.get('id'))
        if not challenge.is_enabled_for_user(user):
            raise Http404
        if challenge.has_enough_user_reviews(user):
            raise Http404
        if not challenge.submitted_by_user(user):
            raise Http404
        review = Review.get_open_review(challenge, user)
        if not review:
            review_candidate = Elaboration.get_review_candidate(challenge, user)
            if review_candidate:
                review = Review(elaboration=review_candidate['candidate'], reviewer=user, chosen_by=review_candidate['chosen_by'])
                review.save()
            else:
                return data
        data['review'] = review
        data['stack_id'] = challenge.get_stack().id
        review_questions = ReviewQuestion.objects.filter(challenge=challenge).order_by("order")
        data['questions'] = review_questions
    return data
开发者ID:Bernhard---H,项目名称:aurora,代码行数:26,代码来源:views.py


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