# HG changeset patch # User Nattee Niparnan # Date 2014-09-30 04:19:39 # Node ID 310e993b7826c58faae28beedaf7768b89e1ca45 # Parent ef96a7a29f255a65121d0ecc99597c3528f5fd59 fix bug for "stuck" and add authorization 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 @@ -1,6 +1,6 @@ class ReportController < ApplicationController - before_filter :admin_authorization, only: [:login_stat,:submission_stat] + before_filter :admin_authorization, only: [:login_stat,:submission_stat, :stuck] before_filter(only: [:problem_hof]) { |c| return false unless authenticate @@ -196,6 +196,7 @@ @struggle = Array.new record = {} Submission.includes(:problem,:user).order(:problem_id,:user_id).find_each do |sub| + next unless sub.problem and sub.user 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}