# HG changeset patch # User Nattee Niparnan # Date 2017-03-10 12:35:55 # Node ID bb242b3ef68d72301306068025c2128c3f8f8ec5 # Parent 43781dd1b0bdc77b0f53c5730f8a2ddd49e9c77a make report max_score remember user options 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 @@ -34,10 +34,12 @@ #process parameters #problems @problems = [] - params[:problem_id].each do |id| - next unless id.strip != "" - pid = Problem.find_by_id(id.to_i) - @problems << pid if pid + if params[:problem_id] + params[:problem_id].each do |id| + next unless id.strip != "" + pid = Problem.find_by_id(id.to_i) + @problems << pid if pid + end end #users @@ -48,11 +50,11 @@ end #set up range from param - since_id = params.fetch(:from_id, 0).to_i - until_id = params.fetch(:to_id, 0).to_i + @since_id = params.fetch(:from_id, 0).to_i + @until_id = params.fetch(:to_id, 0).to_i #calculate the routine - @scorearray = calculate_max_score(@problems, @users,since_id,until_id) + @scorearray = calculate_max_score(@problems, @users, @since_id, @until_id) #rencer accordingly if params[:button] == 'download' then diff --git a/app/views/report/max_score.html.haml b/app/views/report/max_score.html.haml --- a/app/views/report/max_score.html.haml +++ b/app/views/report/max_score.html.haml @@ -22,10 +22,10 @@ Input minimum and maximum range of submission ID that should be included. A blank value for min and max means -1 and infinity, respectively. .form-group = label_tag :from, "Min" - = text_field_tag 'from_id', nil, class: "form-control" + = text_field_tag 'from_id', @since_id, class: "form-control" .form-group = label_tag :from, "Max" - = text_field_tag 'to_id', nil, class: "form-control" + = text_field_tag 'to_id', @until_id, class: "form-control" .col-md-4 .panel.panel-primary .panel-heading diff --git a/app/views/submissions/rejudge.js.haml b/app/views/submissions/rejudge.js.haml --- a/app/views/submissions/rejudge.js.haml +++ b/app/views/submissions/rejudge.js.haml @@ -1,2 +1,2 @@ :plain - $("body").prepend("
Submission #{@submission.id}'s task status has been chaned to \"#{@task.status_str}\"
") + $("body").prepend("
Submission #{@submission.id}'s task status has been changed to \"#{@task.status_str}\". It will be re-judged soon.
")