Ejemplo n.º 1
0
    def _process(self):
        defaults = FormDefaults(
            content_review_questions=self.event.cfp.content_review_questions,
            layout_review_questions=self.event.cfp.layout_review_questions,
            **paper_reviewing_settings.get_all(self.event))
        form = PaperReviewingSettingsForm(event=self.event, obj=defaults)
        if form.validate_on_submit():
            data = form.data
            content_review_questions = data.pop('content_review_questions',
                                                None)
            layout_review_questions = data.pop('layout_review_questions', None)
            if content_review_questions is None:
                content_review_questions = self.event.cfp.content_review_questions
            if layout_review_questions is None:
                layout_review_questions = self.event.cfp.layout_review_questions
            self.event.paper_review_questions = content_review_questions + layout_review_questions

            email_settings = data.pop('email_settings')
            data.update(email_settings)

            paper_reviewing_settings.set_multi(self.event, data)
            flash(_("The reviewing settings were saved successfully"),
                  'success')
            logger.info("Paper reviewing settings of %r updated by %r",
                        self.event, session.user)
            return jsonify_data()
        self.commit = False
        return jsonify_form(form)
Ejemplo n.º 2
0
 def _process(self):
     has_ratings = (PaperReviewRating.query.join(
         PaperReviewRating.review).join(PaperReview.revision).join(
             PaperRevision._contribution).join(
                 PaperReviewRating.question).filter(
                     ~Contribution.is_deleted,
                     Contribution.event == self.event,
                     PaperReviewQuestion.field_type == 'rating').has_rows())
     defaults = FormDefaults(
         content_review_questions=self.event.cfp.content_review_questions,
         layout_review_questions=self.event.cfp.layout_review_questions,
         **paper_reviewing_settings.get_all(self.event))
     form = PaperReviewingSettingsForm(event=self.event,
                                       obj=defaults,
                                       has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         data.update(data.pop('email_settings'))
         paper_reviewing_settings.set_multi(self.event, data)
         flash(_("The reviewing settings were saved successfully"),
               'success')
         logger.info("Paper reviewing settings of %r updated by %r",
                     self.event, session.user)
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)
Ejemplo n.º 3
0
 def _process(self):
     defaults = FormDefaults(content_review_questions=self.event.cfp.content_review_questions,
                             layout_review_questions=self.event.cfp.layout_review_questions,
                             **paper_reviewing_settings.get_all(self.event))
     form = PaperReviewingSettingsForm(event=self.event, obj=defaults, has_ratings=self.ratings_query.has_rows())
     if form.validate_on_submit():
         data = form.data
         data.update(data.pop('email_settings'))
         self._scale_ratings(data['scale_lower'], data['scale_upper'])
         paper_reviewing_settings.set_multi(self.event, data)
         flash(_('The reviewing settings were saved successfully'), 'success')
         logger.info('Paper reviewing settings of %r updated by %r', self.event, session.user)
         return jsonify_data()
     self.commit = False
     return jsonify_form(form)
Ejemplo n.º 4
0
 def _process(self):
     has_ratings = (PaperReviewRating.query
                    .join(PaperReviewRating.review)
                    .join(PaperReview.revision)
                    .join(PaperRevision._contribution)
                    .join(PaperReviewRating.question)
                    .filter(~Contribution.is_deleted,
                            Contribution.event == self.event,
                            PaperReviewQuestion.field_type == 'rating')
                    .has_rows())
     defaults = FormDefaults(content_review_questions=self.event.cfp.content_review_questions,
                             layout_review_questions=self.event.cfp.layout_review_questions,
                             **paper_reviewing_settings.get_all(self.event))
     form = PaperReviewingSettingsForm(event=self.event, obj=defaults, has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         data.update(data.pop('email_settings'))
         paper_reviewing_settings.set_multi(self.event, data)
         flash(_("The reviewing settings were saved successfully"), 'success')
         logger.info("Paper reviewing settings of %r updated by %r", self.event, session.user)
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)
Ejemplo n.º 5
0
    def _process(self):
        defaults = FormDefaults(content_review_questions=self.event.cfp.content_review_questions,
                                layout_review_questions=self.event.cfp.layout_review_questions,
                                **paper_reviewing_settings.get_all(self.event))
        form = PaperReviewingSettingsForm(event=self.event, obj=defaults)
        if form.validate_on_submit():
            data = form.data
            content_review_questions = data.pop('content_review_questions', None)
            layout_review_questions = data.pop('layout_review_questions', None)
            if content_review_questions is None:
                content_review_questions = self.event.cfp.content_review_questions
            if layout_review_questions is None:
                layout_review_questions = self.event.cfp.layout_review_questions
            self.event.paper_review_questions = content_review_questions + layout_review_questions

            email_settings = data.pop('email_settings')
            data.update(email_settings)

            paper_reviewing_settings.set_multi(self.event, data)
            flash(_("The reviewing settings were saved successfully"), 'success')
            logger.info("Paper reviewing settings of %r updated by %r", self.event, session.user)
            return jsonify_data()
        self.commit = False
        return jsonify_form(form)