Skip to content

Commit

Permalink
Add submission date to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsook committed Aug 20, 2018
1 parent cc60c24 commit 034479d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
13 changes: 8 additions & 5 deletions compair/api/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def post(self, course_uuid):

title = [
'Assignment', 'Last Name', 'First Name','Student Number', 'User UUID',
'Answer', 'Answer ID', 'Answer Deleted', 'Answer Last Modified',
'Answer', 'Answer ID', 'Answer Deleted', 'Answer Submission Date', 'Answer Last Modified',
'Answer Score (Normalized)', 'Overall Rank',
'Comparisons Submitted', 'Comparisons Required', 'Comparison Requirements Met',
'Self-Evaluation Submitted', 'Feedback Submitted (During Comparisons)', 'Feedback Submitted (Outside Comparisons)']
Expand Down Expand Up @@ -254,12 +254,13 @@ def participation_stat_report(course, assignments, group, overall):
the_answer = active_answer_list[0] if submitted else None
is_deleted = 'N' if submitted else 'N/A'
answer_uuid = the_answer.uuid if submitted else 'N/A'
answer_submission_date = datetime_to_string(the_answer.submission_date) if submitted else 'N/A'
answer_last_modified = datetime_to_string(the_answer.modified) if submitted else 'N/A'
answer_text = snippet(the_answer.content) if submitted else 'N/A'
answer_rank = the_answer.score.rank if submitted and the_answer.score else 'Not Evaluated'
answer_score = round_score(the_answer.score.normalized_score) if submitted and the_answer.score else 'Not Evaluated'
total[user.id]['total_answers'] += submitted
temp.extend([answer_text, answer_uuid, is_deleted, answer_last_modified, answer_score, answer_rank])
temp.extend([answer_text, answer_uuid, is_deleted, answer_submission_date, answer_last_modified, answer_score, answer_rank])

evaluations = evaluation_submitted.get(user.id, 0)
evaluation_req_met = 'Yes' if evaluations >= assignment.total_comparisons_required else 'No'
Expand All @@ -280,12 +281,13 @@ def participation_stat_report(course, assignments, group, overall):
if submitted > 1:
for answer in active_answer_list[1:]:
answer_uuid = answer.uuid
answer_submission_date = datetime_to_string(answer.submission_date)
answer_last_modified = datetime_to_string(answer.modified)
answer_text = snippet(answer.content)
answer_rank = answer.score.rank if submitted and answer.score else 'Not Evaluated'
answer_score = round_score(answer.score.normalized_score) if submitted and answer.score else 'Not Evaluated'
temp = [assignment.name, user.lastname, user.firstname, user.student_number, user.uuid,
answer_text, answer_uuid, 'N', answer_last_modified,
answer_text, answer_uuid, 'N', answer_submission_date, answer_last_modified,
answer_score, answer_rank,
evaluations, assignment.total_comparisons_required,
evaluation_req_met, comment_self_eval_count, comment_during_comparison_count, comment_outside_comparison_count]
Expand All @@ -296,12 +298,13 @@ def participation_stat_report(course, assignments, group, overall):
if deleted_count > 0:
for answer in deleted_answer_list:
answer_uuid = answer.uuid
answer_submission_date = datetime_to_string(answer.submission_date)
answer_last_modified = datetime_to_string(answer.modified)
answer_text = snippet(answer.content)
answer_rank = answer.score.rank if answer.score else 'Not Evaluated'
answer_score = round_score(answer.score.normalized_score) if answer.score else 'Not Evaluated'
temp = [assignment.name, user.lastname, user.firstname, user.student_number, user.uuid,
answer_text, answer_uuid, 'Y', answer_last_modified,
answer_text, answer_uuid, 'Y', answer_submission_date, answer_last_modified,
answer_score, answer_rank,
evaluations, assignment.total_comparisons_required,
evaluation_req_met, comment_self_eval_count, comment_during_comparison_count, comment_outside_comparison_count]
Expand All @@ -322,7 +325,7 @@ def participation_stat_report(course, assignments, group, overall):
req_met = 'Yes' if sum_submission['total_evaluations'] >= total_req else 'No'
temp = [
'(Overall in Course)', user.lastname, user.firstname, user.student_number, user.uuid,
sum_submission['total_answers'], '', '', '', '', '',
sum_submission['total_answers'], '', '', '', '', '', '',
sum_submission['total_evaluations'], total_req, req_met, sum_submission['total_comments_self_eval'],
sum_submission['total_comments_during_comparison'], sum_submission['total_comments_outside_comparison']]
report.append(temp)
Expand Down
5 changes: 4 additions & 1 deletion compair/tests/api/test_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def test_generate_report(self):
def _check_participation_stat_report_heading_rows(self, heading):
expected_heading = [
'Assignment', 'Last Name', 'First Name', 'Student Number', 'User UUID',
'Answer', 'Answer ID', 'Answer Deleted', 'Answer Last Modified',
'Answer', 'Answer ID', 'Answer Deleted', 'Answer Submission Date', 'Answer Last Modified',
'Answer Score (Normalized)', 'Overall Rank',
'Comparisons Submitted', 'Comparisons Required', 'Comparison Requirements Met',
'Self-Evaluation Submitted', 'Feedback Submitted (During Comparisons)', 'Feedback Submitted (Outside Comparisons)']
Expand Down Expand Up @@ -582,6 +582,7 @@ def _check_participation_stat_report_user_overall_row(self, student, row, overal
expected_row.append("")
expected_row.append("")
expected_row.append("")
expected_row.append("")
expected_row.append(str(user_stats["evaluations_submitted"]))
expected_row.append(str(user_stats["evaluations_required"]))
expected_row.append("Yes" if user_stats["evaluation_requirements_met"] else "No")
Expand Down Expand Up @@ -698,12 +699,14 @@ def _check_participation_stat_report_user_row(self, assignment, student, rows, o
expected_row.append('N' if answer.active else 'Y')
if answer.active:
user_stats["answers_submitted"] += 1
expected_row.append(answer.submission_date.strftime("%Y-%m-%d %H:%M:%S") if answer.submission_date else "N/A")
expected_row.append(answer.modified.strftime("%Y-%m-%d %H:%M:%S") if answer.modified else "N/A")
else:
expected_row.append("N/A")
expected_row.append("N/A")
expected_row.append("N/A")
expected_row.append("N/A")
expected_row.append("N/A")

if answer and answer.score:
expected_row.append(str(round(answer.score.normalized_score, 0))) # round the floating point value for comparison
Expand Down

0 comments on commit 034479d

Please sign in to comment.