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


Python Elaboration.get_missing_reviews方法代码示例

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


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

示例1: missing_reviews

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_missing_reviews [as 别名]
def missing_reviews(request, course_short_title=None):
    course = Course.get_or_raise_404(short_title=course_short_title)
    elaborations = Elaboration.get_missing_reviews(course)

    # sort elaborations by submission time
    if type(elaborations) == list:
        elaborations.sort(key=lambda elaboration: elaboration.submission_time)
    else:
        elaborations = elaborations.order_by('submission_time')

    # store selected elaborations in session
    request.session['elaborations'] = serializers.serialize(
        'json', elaborations)
    request.session['selection'] = 'missing_reviews'
    request.session['count'] = len(elaborations)

    return render_to_response('evaluation.html',
                              {'overview': render_to_string('overview.html', {'elaborations': elaborations, 'course': course},
                                                            RequestContext(request)),
                               'count_missing_reviews': request.session.get('count', '0'),
                               'stabilosiert_missing_reviews': 'stabilosiert',
                               'selection': request.session['selection'],
                               'course': course
                               },
                              context_instance=RequestContext(request))
开发者ID:martflu,项目名称:aurora,代码行数:27,代码来源:views.py

示例2: missing_reviews

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_missing_reviews [as 别名]
def missing_reviews(request, course_short_title=None):
    course = Course.get_or_raise_404(short_title=course_short_title)
    elaborations = Elaboration.get_missing_reviews(course)

    # sort elaborations by submission time
    if type(elaborations) == list:
        elaborations.sort(key=lambda elaboration: elaboration.submission_time)
    else:
        elaborations = elaborations.order_by("submission_time")

    # store selected elaborations in session
    request.session["elaborations"] = serializers.serialize("json", elaborations)
    request.session["selection"] = "missing_reviews"
    request.session["count"] = len(elaborations)

    return render_to_response(
        "evaluation.html",
        {
            "overview": render_to_string(
                "overview.html", {"elaborations": elaborations, "course": course}, RequestContext(request)
            ),
            "count_missing_reviews": request.session.get("count", "0"),
            "stabilosiert_missing_reviews": "stabilosiert",
            "selection": request.session["selection"],
            "course": course,
        },
        context_instance=RequestContext(request),
    )
开发者ID:flozzone,项目名称:aurora,代码行数:30,代码来源:views.py

示例3: back

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_missing_reviews [as 别名]
def back(request, course_short_title=None):
    selection = request.session.get('selection', 'error')
    course = Course.get_or_raise_404(short_title=course_short_title)

    if selection == "search":
        return HttpResponse()
    if selection == "missing_reviews":
        elaborations = Elaboration.get_missing_reviews(course)
    if selection == "top_level_tasks":
        elaborations = Elaboration.get_top_level_tasks(course)
    if selection == "non_adequate_work":
        elaborations = Elaboration.get_non_adequate_work(course)
    if selection == "complaints":
        elaborations = Elaboration.get_complaints(course)
    if selection == "awesome":
        elaborations = Elaboration.get_awesome(course)
    if selection == "evaluated_non_adequate_work":
        elaborations = Elaboration.get_evaluated_non_adequate_work(course)

    # update overview
    if type(elaborations) == list:
        elaborations.sort(key=lambda elaboration: elaboration.submission_time)
    else:
        elaborations = elaborations.order_by('submission_time')
    request.session['elaborations'] = serializers.serialize('json', elaborations)

    return evaluation(request, course_short_title)
开发者ID:bobschi,项目名称:aurora,代码行数:29,代码来源:views.py

示例4: review_answer

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_missing_reviews [as 别名]
def review_answer(request, course_short_title=None):
    course = Course.get_or_raise_404(short_title=course_short_title)

    data = request.body.decode(encoding='UTF-8')
    data = json.loads(data)

    user = request.user
    answers = data['answers']
    elab_id_from_client = data['elab']

    review = Review.objects.create(
        elaboration_id=elab_id_from_client, reviewer_id=user.id)

    review.appraisal = data['appraisal']
    review.submission_time = datetime.now()
    review.save()
    for answer in answers:
        question_id = answer['question_id']
        text = answer['answer']
        review_question = ReviewQuestion.objects.get(pk=question_id)
        ReviewAnswer(
            review=review, review_question=review_question, text=text).save()
    if review.appraisal == review.NOTHING:
        Notification.bad_review(review)
    else:
        Notification.enough_peer_reviews(review)
    # update overview
    elaborations = Elaboration.get_missing_reviews(course)
    if type(elaborations) == list:
        elaborations.sort(key=lambda elaboration: elaboration.submission_time)
    else:
        elaborations = elaborations.order_by('submission_time')
    request.session['elaborations'] = serializers.serialize(
        'json', elaborations)

    if review.elaboration.is_reviewed_2times():
        evaluation_url = reverse('Evaluation:home', args=[course_short_title])
    else:
        evaluation_url = reverse('Evaluation:detail', args=[course_short_title])\
            + "?elaboration_id=" + str(review.elaboration.id)

    return HttpResponse(evaluation_url)
开发者ID:martflu,项目名称:aurora,代码行数:44,代码来源:views.py

示例5: review_answer

# 需要导入模块: from Elaboration.models import Elaboration [as 别名]
# 或者: from Elaboration.models.Elaboration import get_missing_reviews [as 别名]
def review_answer(request, course_short_title=None):
    course = Course.get_or_raise_404(short_title=course_short_title)

    data = request.body.decode(encoding="UTF-8")
    data = json.loads(data)

    user = RequestContext(request)["user"]
    answers = data["answers"]

    review = Review.objects.create(elaboration_id=request.session.get("elaboration_id", ""), reviewer_id=user.id)

    review.appraisal = data["appraisal"]
    review.submission_time = datetime.now()
    review.save()
    for answer in answers:
        question_id = answer["question_id"]
        text = answer["answer"]
        review_question = ReviewQuestion.objects.get(pk=question_id)
        ReviewAnswer(review=review, review_question=review_question, text=text).save()
    if review.appraisal == review.NOTHING:
        Notification.bad_review(review)
    else:
        Notification.enough_peer_reviews(review)
    # update overview
    elaborations = Elaboration.get_missing_reviews(course)
    if type(elaborations) == list:
        elaborations.sort(key=lambda elaboration: elaboration.submission_time)
    else:
        elaborations = elaborations.order_by("submission_time")
    request.session["elaborations"] = serializers.serialize("json", elaborations)

    if review.elaboration.is_reviewed_2times():
        evaluation_url = reverse("Evaluation:home", args=[course_short_title])
    else:
        evaluation_url = (
            reverse("Evaluation:detail", args=[course_short_title]) + "?elaboration_id=" + str(review.elaboration.id)
        )

    return HttpResponse(evaluation_url)
开发者ID:flozzone,项目名称:aurora,代码行数:41,代码来源:views.py


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