Skip to content

Commit

Permalink
Address #502 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-gardener committed Mar 6, 2017
1 parent 47b2178 commit 9af2083
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
17 changes: 13 additions & 4 deletions compair/api/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)

Expand Down
18 changes: 13 additions & 5 deletions compair/tests/api/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -647,16 +647,16 @@ 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)
expected_heading2 = [
"Assignment",
"Last Name", "First Name", "Student No",
"Last Name", "First Name", "Student No",
"Type", "Feedback"
"Feedback Type", "Feedback"
]
self.assertEqual(expected_heading2, heading2)

Expand All @@ -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)
Expand Down

0 comments on commit 9af2083

Please sign in to comment.