diff --git a/app/controllers/report_controller.rb b/app/controllers/report_controller.rb --- a/app/controllers/report_controller.rb +++ b/app/controllers/report_controller.rb @@ -196,6 +196,7 @@ @struggle = Array.new record = {} Submission.includes(:problem,:user).order(:problem_id,:user_id).find_each do |sub| + next unless sub.user and sub.problem if user != sub.user_id or problem != sub.problem_id @struggle << { user: record[:user], problem: record[:problem], tries: tries } unless solve record = {user: sub.user, problem: sub.problem} diff --git a/app/views/graders/list.html.haml b/app/views/graders/list.html.haml --- a/app/views/graders/list.html.haml +++ b/app/views/graders/list.html.haml @@ -66,7 +66,7 @@ %td= sub.try(:user).try(:full_name) %td= sub.try(:problem).try(:full_name) %td= "#{time_ago_in_words(sub.submitted_at)} ago" - %td= "#{time_ago_in_words(sub.graded_at)} ago" + %td= "#{sub.graded_at ? time_ago_in_words(sub.graded_at) : ''} ago" %td= sub.grader_comment