diff --git a/compair/api/report.py b/compair/api/report.py index 109525491..7301591ae 100644 --- a/compair/api/report.py +++ b/compair/api/report.py @@ -113,15 +113,15 @@ def post(self, course_uuid): elif report_type == "peer_feedback": titles1 = [ "", - "Sender", "", "", - "Receiver", "", "", + "Feedback Author", "", "", + "Answer Author", "", "", "", "" ] titles2 = [ "Assignment", "Last Name", "First Name", "Student No", "Last Name", "First Name", "Student No", - "Type", "Feedback" + "Feedback Type", "Feedback" ] data = peer_feedback_report(course, assignments, group_name) titles = [titles1, titles2] @@ -393,11 +393,20 @@ def peer_feedback_report(course, assignments, group_name): if len(user_sent_feedback) > 0: for feedback in user_sent_feedback: + + feedback_type = "" + if feedback.comment_type == AnswerCommentType.evaluation: + feedback_type = "Comparison" + elif feedback.comment_type == AnswerCommentType.private: + feedback_type = "Private Reply" + elif feedback.comment_type == AnswerCommentType.public: + feedback_type = "Public Reply" + temp = [ assignment.name, user.lastname, user.firstname, user.student_number, feedback.receiver_lastname, feedback.receiver_firstname, feedback.receiver_student_number, - feedback.comment_type.value, strip_html(feedback.content) + feedback_type, strip_html(feedback.content) ] report.append(temp) diff --git a/compair/tests/api/test_report.py b/compair/tests/api/test_report.py index 1184aa6a0..e9465a429 100644 --- a/compair/tests/api/test_report.py +++ b/compair/tests/api/test_report.py @@ -6,7 +6,7 @@ from data.fixtures.test_data import TestFixture from compair.tests.test_compair import ComPAIRAPITestCase -from compair.models import CourseRole, Answer, Comparison, AnswerComment +from compair.models import CourseRole, Answer, Comparison, AnswerComment, AnswerCommentType from compair.core import db from flask import current_app @@ -647,8 +647,8 @@ def _check_participation_report_user_row(self, assignments, student, row): def _check_peer_feedback_report_heading_rows(self, heading1, heading2): expected_heading1 = [ "", - "Sender", "", "", - "Receiver", "", "", + "Feedback Author", "", "", + "Answer Author", "", "", "", "" ] self.assertEqual(expected_heading1, heading1) @@ -656,7 +656,7 @@ def _check_peer_feedback_report_heading_rows(self, heading1, heading2): "Assignment", "Last Name", "First Name", "Student No", "Last Name", "First Name", "Student No", - "Type", "Feedback" + "Feedback Type", "Feedback" ] self.assertEqual(expected_heading2, heading2) @@ -672,11 +672,19 @@ def _check_peer_feedback_report_user_rows(self, assignment, student, reader): row = next(reader) answer_user = answer_comment.answer.user + feedback_type = "" + if answer_comment.comment_type == AnswerCommentType.evaluation: + feedback_type = "Comparison" + elif answer_comment.comment_type == AnswerCommentType.private: + feedback_type = "Private Reply" + elif answer_comment.comment_type == AnswerCommentType.public: + feedback_type = "Public Reply" + excepted_row = [ assignment.name, student.lastname, student.firstname, student.student_number, answer_user.lastname, answer_user.firstname, answer_user.student_number, - answer_comment.comment_type.value, self._strip_html(answer_comment.content) + feedback_type, self._strip_html(answer_comment.content) ] self.assertEqual(row, excepted_row)