def _scale_ratings(self, scale_min, scale_max): prev_min = abstracts_reviewing_settings.get(self.event, 'scale_lower') prev_max = abstracts_reviewing_settings.get(self.event, 'scale_upper') if scale_min == prev_min and scale_max == prev_max: return assert scale_max > scale_min abstracts_reviewing_settings.set_multi(self.event, { 'scale_lower': scale_min, 'scale_upper': scale_max, }) for rating in self.ratings_query: if rating.value is None: continue value = (rating.value - prev_min) / (prev_max - prev_min) rating.value = round(value * (scale_max - scale_min) + scale_min)
def _process(self): form = AbstractCommentForm(abstract=self.abstract, user=session.user) if form.validate_on_submit(): create_abstract_comment(self.abstract, form.data) if abstracts_reviewing_settings.get(self.event, 'notify_on_new_comments'): visibility = form.visibility.data if form.visibility else AbstractCommentVisibility.contributors recipients = self._get_recipients(visibility) - {session.user} comment = form.text.data self._send_notification(recipients, comment) return jsonify_data(flash=False, html=render_abstract_page( self.abstract, management=self.management)) tpl = get_template_module('events/reviews/forms.html') return jsonify( html=tpl.render_comment_form(form, proposal=self.abstract))
def rating_range(self): return tuple( abstracts_reviewing_settings.get(self.event, key) for key in ('scale_lower', 'scale_upper'))
def rating_range(self): return tuple(abstracts_reviewing_settings.get(self.event, key) for key in ("scale_lower", "scale_upper"))