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: 8 inserted, 6 deleted
@@ -25,43 +25,45 | |||||
|
25 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
25 | csv = gen_csv_from_scorearray(@scorearray,@problems) |
|
26 | send_data csv, filename: 'max_score.csv' |
|
26 | send_data csv, filename: 'max_score.csv' |
|
27 | else |
|
27 | else |
|
28 | #render template: 'user_admin/user_stat' |
|
28 | #render template: 'user_admin/user_stat' |
|
29 | render 'current_score' |
|
29 | render 'current_score' |
|
30 | end |
|
30 | end |
|
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 | + if params[:problem_id] | ||
|
37 | params[:problem_id].each do |id| |
|
38 | params[:problem_id].each do |id| |
|
38 | next unless id.strip != "" |
|
39 | next unless id.strip != "" |
|
39 | pid = Problem.find_by_id(id.to_i) |
|
40 | pid = Problem.find_by_id(id.to_i) |
|
40 | @problems << pid if pid |
|
41 | @problems << pid if pid |
|
41 | end |
|
42 | 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 |
|
62 | #render template: 'user_admin/user_stat' |
|
64 | #render template: 'user_admin/user_stat' |
|
63 | render 'max_score' |
|
65 | render 'max_score' |
|
64 | end |
|
66 | end |
|
65 |
|
67 | ||
|
66 | end |
|
68 | end |
|
67 |
|
69 |
@@ -13,28 +13,28 | |||||
|
13 | = select_tag 'problem_id[]', |
|
13 | = select_tag 'problem_id[]', |
|
14 | options_for_select(Problem.all.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]},params[:problem_id]), |
|
14 | options_for_select(Problem.all.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]},params[:problem_id]), |
|
15 | { class: 'select2 form-control', multiple: "true" } |
|
15 | { class: 'select2 form-control', multiple: "true" } |
|
16 | .col-md-4 |
|
16 | .col-md-4 |
|
17 | .panel.panel-primary |
|
17 | .panel.panel-primary |
|
18 | .panel-heading |
|
18 | .panel-heading |
|
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 |
|
35 | %label |
|
35 | %label |
|
36 | = radio_button_tag 'users', 'all', true |
|
36 | = radio_button_tag 'users', 'all', true |
|
37 | All users |
|
37 | All users |
|
38 | .radio |
|
38 | .radio |
|
39 | %label |
|
39 | %label |
|
40 | = radio_button_tag 'users', 'enabled' |
|
40 | = radio_button_tag 'users', 'enabled' |
@@ -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