From 284c83d95aab393c48d980d3d790c74bacae67aa Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Wed, 15 Nov 2023 20:43:47 +0400 Subject: [PATCH] Fix empty issue messages --- anytask/issues/models.py | 10 +++++----- anytask/users/templates/user_courses.html | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/anytask/issues/models.py b/anytask/issues/models.py index ac4b27590..f09565fd4 100644 --- a/anytask/issues/models.py +++ b/anytask/issues/models.py @@ -303,7 +303,7 @@ def set_field(self, field, value, author=None, from_contest=False): elif name == 'costudents_names': delete_event, value = self.set_field_costudents_names(value) elif name == 'comment': - value = self.set_field_comment(author, course, event, value) + delete_event, value = self.set_field_comment(author, course, event, value) elif name == 'status': delete_event, value = self.set_field_status(value) elif name == 'mark': @@ -389,17 +389,17 @@ def set_field_comment(self, author, course, event, value): if self.task.rb_integrated \ and (course.send_rb_and_contest_together or not self.task.contest_integrated): self.set_field_comment_rb_integrated(course, event, file, value) - + if not value['files'] and not value['comment']: - event.delete() - return + return True, None # Do not include empty comments else: self.update_time = timezone.now() value = u'
' + value['comment'] + u'
' if not self.is_status_auto_verification() and not self.is_status_accepted(): self.set_field_comment_update_status(author, sent) - return value + + return False, value def set_field_comment_update_status(self, author, sent): if author == self.student and not self.is_status_need_info() and sent: diff --git a/anytask/users/templates/user_courses.html b/anytask/users/templates/user_courses.html index 7e948d669..a17d9c28f 100644 --- a/anytask/users/templates/user_courses.html +++ b/anytask/users/templates/user_courses.html @@ -83,7 +83,7 @@
{% for year, courses_in_year in table %}
- {% for table_id, course_statistics in courses_in_year.iteritems %} + {% for table_id, course_statistics in courses_in_year.items %}