Description:
make report max_score remember user options
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r647:bb242b3ef68d - - 3 files changed: 12 inserted, 10 deleted
@@ -31,31 +31,33 | |||||
|
31 | end |
|
31 | end |
|
32 |
|
32 | ||
|
33 | def show_max_score |
|
33 | def show_max_score |
|
34 | #process parameters |
|
34 | #process parameters |
|
35 | #problems |
|
35 | #problems |
|
36 | @problems = [] |
|
36 | @problems = [] |
|
37 |
- params[:problem_id] |
|
37 | + if params[:problem_id] |
|
38 | - next unless id.strip != "" |
|
38 | + params[:problem_id].each do |id| |
|
39 | - pid = Problem.find_by_id(id.to_i) |
|
39 | + next unless id.strip != "" |
|
40 | - @problems << pid if pid |
|
40 | + pid = Problem.find_by_id(id.to_i) |
|
|
41 | + @problems << pid if pid | ||
|
|
42 | + end | ||
|
41 | end |
|
43 | end |
|
42 |
|
44 | ||
|
43 | #users |
|
45 | #users |
|
44 | @users = if params[:user] == "all" then |
|
46 | @users = if params[:user] == "all" then |
|
45 | User.includes(:contests).includes(:contest_stat) |
|
47 | User.includes(:contests).includes(:contest_stat) |
|
46 | else |
|
48 | else |
|
47 | User.includes(:contests).includes(:contest_stat).where(enabled: true) |
|
49 | User.includes(:contests).includes(:contest_stat).where(enabled: true) |
|
48 | end |
|
50 | end |
|
49 |
|
51 | ||
|
50 | #set up range from param |
|
52 | #set up range from param |
|
51 | - since_id = params.fetch(:from_id, 0).to_i |
|
53 | + @since_id = params.fetch(:from_id, 0).to_i |
|
52 | - until_id = params.fetch(:to_id, 0).to_i |
|
54 | + @until_id = params.fetch(:to_id, 0).to_i |
|
53 |
|
55 | ||
|
54 | #calculate the routine |
|
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 | #rencer accordingly |
|
59 | #rencer accordingly |
|
58 | if params[:button] == 'download' then |
|
60 | if params[:button] == 'download' then |
|
59 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
61 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
60 | send_data csv, filename: 'max_score.csv' |
|
62 | send_data csv, filename: 'max_score.csv' |
|
61 | else |
|
63 | else |
@@ -19,16 +19,16 | |||||
|
19 | Submission range |
|
19 | Submission range |
|
20 | .panel-body |
|
20 | .panel-body |
|
21 | %p |
|
21 | %p |
|
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. |
|
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 | .form-group |
|
23 | .form-group |
|
24 | = label_tag :from, "Min" |
|
24 | = label_tag :from, "Min" |
|
25 |
- = text_field_tag 'from_id', |
|
25 | + = text_field_tag 'from_id', @since_id, class: "form-control" |
|
26 | .form-group |
|
26 | .form-group |
|
27 | = label_tag :from, "Max" |
|
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 | .col-md-4 |
|
29 | .col-md-4 |
|
30 | .panel.panel-primary |
|
30 | .panel.panel-primary |
|
31 | .panel-heading |
|
31 | .panel-heading |
|
32 | Users |
|
32 | Users |
|
33 | .panel-body |
|
33 | .panel-body |
|
34 | .radio |
|
34 | .radio |
@@ -1,2 +1,2 | |||||
|
1 | :plain |
|
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