Esempio n. 1
0
 def _process(self):
     has_ratings = (AbstractReviewRating.query.join(
         AbstractReviewRating.review).join(AbstractReview.abstract).filter(
             ~Abstract.is_deleted,
             Abstract.event_new == self.event_new).has_rows())
     defaults = FormDefaults(
         abstract_review_questions=self.event_new.abstract_review_questions,
         **abstracts_reviewing_settings.get_all(self.event_new))
     form = AbstractReviewingSettingsForm(event=self.event_new,
                                          obj=defaults,
                                          has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         # XXX: we need to do this assignment for new questions,
         # but editing or deleting existing questions changes an
         # object that is already in the session so it's updated
         # in any case
         self.event_new.abstract_review_questions = data.pop(
             'abstract_review_questions')
         abstracts_reviewing_settings.set_multi(self.event_new, data)
         flash(_('Abstract reviewing settings have been saved'), 'success')
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)
Esempio n. 2
0
 def _clone_settings(self, new_event):
     old_settings = abstracts_settings.get_all(self.old_event, no_defaults=True)
     offset = new_event.start_dt - self.old_event.start_dt
     for key in ('start_dt', 'end_dt', 'modification_end_dt'):
         if not old_settings.get(key):
             continue
         old_settings[key] += offset
     abstracts_settings.set_multi(new_event, old_settings)
     abstracts_reviewing_settings.set_multi(new_event, abstracts_reviewing_settings.get_all(self.old_event,
                                                                                            no_defaults=True))
     boa_settings.set_multi(new_event, boa_settings.get_all(self.old_event, no_defaults=True))
Esempio n. 3
0
 def _clone_settings(self, new_event):
     old_settings = abstracts_settings.get_all(self.old_event, no_defaults=True)
     offset = new_event.start_dt - self.old_event.start_dt
     for key in ('start_dt', 'end_dt', 'modification_end_dt'):
         if not old_settings.get(key):
             continue
         old_settings[key] += offset
     abstracts_settings.set_multi(new_event, old_settings)
     abstracts_reviewing_settings.set_multi(new_event, abstracts_reviewing_settings.get_all(self.old_event,
                                                                                            no_defaults=True))
     boa_settings.set_multi(new_event, boa_settings.get_all(self.old_event, no_defaults=True))
Esempio n. 4
0
 def _process(self):
     defaults = FormDefaults(**abstracts_reviewing_settings.get_all(self.event))
     form = AbstractReviewingSettingsForm(event=self.event, obj=defaults, has_ratings=self.ratings_query.has_rows())
     if form.validate_on_submit():
         data = form.data
         self._scale_ratings(data['scale_lower'], data['scale_upper'])
         abstracts_reviewing_settings.set_multi(self.event, data)
         flash(_('Abstract reviewing settings have been saved'), 'success')
         return jsonify_data()
     self.commit = False
     return jsonify_form(form)
Esempio n. 5
0
 def _process(self):
     has_ratings = (AbstractReviewRating.query
                    .join(AbstractReviewRating.review)
                    .join(AbstractReview.abstract)
                    .join(AbstractReviewRating.question)
                    .filter(~Abstract.is_deleted, Abstract.event == self.event,
                            AbstractReviewQuestion.field_type == 'rating')
                    .has_rows())
     defaults = FormDefaults(**abstracts_reviewing_settings.get_all(self.event))
     form = AbstractReviewingSettingsForm(event=self.event, obj=defaults, has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         abstracts_reviewing_settings.set_multi(self.event, data)
         flash(_('Abstract reviewing settings have been saved'), 'success')
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)
Esempio n. 6
0
 def _process(self):
     has_ratings = (AbstractReviewRating.query
                    .join(AbstractReviewRating.review)
                    .join(AbstractReview.abstract)
                    .join(AbstractReviewRating.question)
                    .filter(~Abstract.is_deleted, Abstract.event == self.event,
                            AbstractReviewQuestion.field_type == 'rating')
                    .has_rows())
     defaults = FormDefaults(**abstracts_reviewing_settings.get_all(self.event))
     form = AbstractReviewingSettingsForm(event=self.event, obj=defaults, has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         abstracts_reviewing_settings.set_multi(self.event, data)
         flash(_('Abstract reviewing settings have been saved'), 'success')
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)
Esempio n. 7
0
 def _process(self):
     has_ratings = (AbstractReviewRating.query
                    .join(AbstractReviewRating.review)
                    .join(AbstractReview.abstract)
                    .filter(~Abstract.is_deleted, Abstract.event_new == self.event_new)
                    .has_rows())
     defaults = FormDefaults(abstract_review_questions=self.event_new.abstract_review_questions,
                             **abstracts_reviewing_settings.get_all(self.event_new))
     form = AbstractReviewingSettingsForm(event=self.event_new, obj=defaults, has_ratings=has_ratings)
     if form.validate_on_submit():
         data = form.data
         # XXX: we need to do this assignment for new questions,
         # but editing or deleting existing questions changes an
         # object that is already in the session so it's updated
         # in any case
         self.event_new.abstract_review_questions = data.pop('abstract_review_questions')
         abstracts_reviewing_settings.set_multi(self.event_new, data)
         flash(_('Abstract reviewing settings have been saved'), 'success')
         return jsonify_data()
     self.commit = False
     disabled_fields = form.RATING_FIELDS if has_ratings else ()
     return jsonify_form(form, disabled_fields=disabled_fields)