예제 #1
0
def build_review_form(paper_revision=None, review_type=None, review=None):
    if review:
        paper_revision = review.revision
        review_type = PaperTypeProxy(review.type)

    review_form_class = make_review_form(paper_revision.paper.event, review_type=review_type.instance)
    reviews = paper_revision.get_reviews(user=session.user, group=review_type.instance)
    latest_user_review = reviews[0] if reviews else None
    if latest_user_review:
        answers = {'question_{}'.format(rating.question.id): rating.value
                   for rating in latest_user_review.ratings}
        defaults = FormDefaults(obj=latest_user_review, **answers)
    else:
        defaults = FormDefaults()

    return review_form_class(prefix='type-{}'.format(review_type.instance.value), obj=defaults,
                             paper=paper_revision.paper, edit=review is not None)
예제 #2
0
파일: api.py 프로젝트: mkopcic/indico
 def _process_args(self):
     RHPaperBase._process_args(self)
     self.type = PaperTypeProxy(
         PaperReviewType[request.view_args['review_type']])
예제 #3
0
 def _checkParams(self, params):
     RHPaperBase._checkParams(self, params)
     self.type = PaperTypeProxy(
         PaperReviewType[request.view_args['review_type']])