Skip to content

Commit

Permalink
Use friendly_value for event logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mic4ael authored and ThiefMaster committed Jan 17, 2018
1 parent 26322c4 commit ad8de30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions indico/modules/events/abstracts/operations.py
Expand Up @@ -338,7 +338,7 @@ def create_abstract_review(abstract, track, user, review_data, questions_data):
for question in abstract.event.abstract_review_questions:
value = questions_data['question_{}'.format(question.id)]
review.ratings.append(AbstractReviewRating(question=question, value=value))
log_data[question.text] = value
log_data[question.text] = question.field.get_friendly_value(value)
db.session.flush()
logger.info("Abstract %s received a review by %s for track %s", abstract, user, track)
log_data.update({
Expand Down Expand Up @@ -369,7 +369,8 @@ def update_abstract_review(review, review_data, questions_data):
old_value = rating.value
rating.value = questions_data[field_name]
if old_value != rating.value:
changes[field_name] = (old_value, rating.value)
changes[field_name] = (question.field.get_friendly_value(old_value),
question.field.get_friendly_value(rating.value))
log_fields[field_name] = {
'title': question.text,
'type': question.field_type
Expand Down
5 changes: 3 additions & 2 deletions indico/modules/events/papers/operations.py
Expand Up @@ -272,7 +272,7 @@ def create_review(paper, review_type, user, review_data, questions_data):
for question in paper.event.cfp.get_questions_for_review_type(review_type.instance):
value = questions_data['question_{}'.format(question.id)]
review.ratings.append(PaperReviewRating(question=question, value=value))
log_data[question.text] = value
log_data[question.text] = question.field.get_friendly_value(value)
db.session.flush()
notify_paper_review_submission(review)
logger.info("Paper %r received a review of type %s by %r", paper, review_type.instance.name, user)
Expand All @@ -299,7 +299,8 @@ def update_review(review, review_data, questions_data):
old_value = rating.value
rating.value = questions_data[field_name]
if old_value != rating.value:
changes[field_name] = (old_value, rating.value)
changes[field_name] = (question.field.get_friendly_value(old_value),
question.field.get_friendly_value(rating.value))
log_fields[field_name] = {
'title': question.text,
'type': question.field_type
Expand Down

0 comments on commit ad8de30

Please sign in to comment.