Description:
make report max_score remember user options
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r647:bb242b3ef68d - - 3 files changed: 12 inserted, 10 deleted

@@ -31,31 +31,33
31 31 end
32 32
33 33 def show_max_score
34 34 #process parameters
35 35 #problems
36 36 @problems = []
37 - params[:problem_id].each do |id|
38 - next unless id.strip != ""
39 - pid = Problem.find_by_id(id.to_i)
40 - @problems << pid if pid
37 + if params[:problem_id]
38 + params[:problem_id].each do |id|
39 + next unless id.strip != ""
40 + pid = Problem.find_by_id(id.to_i)
41 + @problems << pid if pid
42 + end
41 43 end
42 44
43 45 #users
44 46 @users = if params[:user] == "all" then
45 47 User.includes(:contests).includes(:contest_stat)
46 48 else
47 49 User.includes(:contests).includes(:contest_stat).where(enabled: true)
48 50 end
49 51
50 52 #set up range from param
51 - since_id = params.fetch(:from_id, 0).to_i
52 - until_id = params.fetch(:to_id, 0).to_i
53 + @since_id = params.fetch(:from_id, 0).to_i
54 + @until_id = params.fetch(:to_id, 0).to_i
53 55
54 56 #calculate the routine
55 - @scorearray = calculate_max_score(@problems, @users,since_id,until_id)
57 + @scorearray = calculate_max_score(@problems, @users, @since_id, @until_id)
56 58
57 59 #rencer accordingly
58 60 if params[:button] == 'download' then
59 61 csv = gen_csv_from_scorearray(@scorearray,@problems)
60 62 send_data csv, filename: 'max_score.csv'
61 63 else
@@ -19,16 +19,16
19 19 Submission range
20 20 .panel-body
21 21 %p
22 22 Input minimum and maximum range of submission ID that should be included. A blank value for min and max means -1 and infinity, respectively.
23 23 .form-group
24 24 = label_tag :from, "Min"
25 - = text_field_tag 'from_id', nil, class: "form-control"
25 + = text_field_tag 'from_id', @since_id, class: "form-control"
26 26 .form-group
27 27 = label_tag :from, "Max"
28 - = text_field_tag 'to_id', nil, class: "form-control"
28 + = text_field_tag 'to_id', @until_id, class: "form-control"
29 29 .col-md-4
30 30 .panel.panel-primary
31 31 .panel-heading
32 32 Users
33 33 .panel-body
34 34 .radio
@@ -1,2 +1,2
1 1 :plain
2 - $("body").prepend("<div class=\"alert alert-info\"> Submission #{@submission.id}'s task status has been chaned to \"#{@task.status_str}\" </div>")
2 + $("body").prepend("<div class=\"alert alert-info\"> Submission #{@submission.id}'s task status has been changed to \"#{@task.status_str}\". It will be re-judged soon. </div>")
You need to be logged in to leave comments. Login now