Description:
add autoset exam mode
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r765:3ce2a4681a0f - - 4 files changed: 29 inserted, 4 deleted
@@ -3,30 +3,40 | |||||
|
3 | before_action :admin_authorization |
|
3 | before_action :admin_authorization |
|
4 |
|
4 | ||
|
5 | def index |
|
5 | def index |
|
6 | @configurations = GraderConfiguration.order(:key) |
|
6 | @configurations = GraderConfiguration.order(:key) |
|
7 | @group = GraderConfiguration.pluck("grader_configurations.key").map{ |x| x[0...(x.index('.'))] }.uniq.sort |
|
7 | @group = GraderConfiguration.pluck("grader_configurations.key").map{ |x| x[0...(x.index('.'))] }.uniq.sort |
|
8 | end |
|
8 | end |
|
9 |
|
9 | ||
|
10 | def reload |
|
10 | def reload |
|
11 | GraderConfiguration.reload |
|
11 | GraderConfiguration.reload |
|
12 | redirect_to :action => 'index' |
|
12 | redirect_to :action => 'index' |
|
13 | end |
|
13 | end |
|
14 |
|
14 | ||
|
15 | def update |
|
15 | def update |
|
16 | @config = GraderConfiguration.find(params[:id]) |
|
16 | @config = GraderConfiguration.find(params[:id]) |
|
17 | User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' |
|
17 | User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' |
|
18 | respond_to do |format| |
|
18 | respond_to do |format| |
|
19 | if @config.update_attributes(configuration_params) |
|
19 | if @config.update_attributes(configuration_params) |
|
20 | format.json { head :ok } |
|
20 | format.json { head :ok } |
|
21 | else |
|
21 | else |
|
22 | format.json { respond_with_bip(@config) } |
|
22 | format.json { respond_with_bip(@config) } |
|
23 | end |
|
23 | end |
|
24 | end |
|
24 | end |
|
25 | end |
|
25 | end |
|
26 |
|
26 | ||
|
|
27 | + def set_exam_right | ||
|
|
28 | + value = params[:value] || 'false' | ||
|
|
29 | + GraderConfiguration.where(key: "right.bypass_agreement").update(value: value); | ||
|
|
30 | + GraderConfiguration.where(key: "right.multiple_ip_login").update(value: value); | ||
|
|
31 | + GraderConfiguration.where(key: "right.user_hall_of_fame").update(value: value); | ||
|
|
32 | + GraderConfiguration.where(key: "right.user_view_submission ").update(value: value); | ||
|
|
33 | + GraderConfiguration.where(key: "right.view_testcase ").update(value: value); | ||
|
|
34 | + redirect_to :action => 'index' | ||
|
|
35 | + end | ||
|
|
36 | + | ||
|
27 | private |
|
37 | private |
|
28 | def configuration_params |
|
38 | def configuration_params |
|
29 | params.require(:grader_configuration).permit(:key,:value_type,:value,:description) |
|
39 | params.require(:grader_configuration).permit(:key,:value_type,:value,:description) |
|
30 | end |
|
40 | end |
|
31 |
|
41 | ||
|
32 | end |
|
42 | end |
@@ -1,37 +1,48 | |||||
|
1 | /- content_for :header do |
|
1 | /- content_for :header do |
|
2 | / = javascript_include_tag 'local_jquery' |
|
2 | / = javascript_include_tag 'local_jquery' |
|
3 |
|
3 | ||
|
|
4 | + .container-fluid | ||
|
|
5 | + .row | ||
|
|
6 | + .col-md-12 | ||
|
4 | %h1 System configuration |
|
7 | %h1 System configuration |
|
|
8 | + .row | ||
|
|
9 | + .col-md-12 | ||
|
|
10 | + = link_to 'Set exam mode', set_exam_right_grader_configuration_index_path('false'), class: 'btn btn-warning' | ||
|
|
11 | + = link_to 'Set practice mode', set_exam_right_grader_configuration_index_path('true'), class: 'btn btn-info' | ||
|
5 |
|
12 | ||
|
6 | - @group.each do |g| |
|
13 | - @group.each do |g| |
|
|
14 | + .row | ||
|
|
15 | + .col-md-12 | ||
|
7 | %h2= g |
|
16 | %h2= g |
|
8 | %table.table.table-striped |
|
17 | %table.table.table-striped |
|
9 | %thead |
|
18 | %thead |
|
10 | %th{style: 'width: 25%'} Key |
|
19 | %th{style: 'width: 25%'} Key |
|
11 | %th{style: 'width: 10%'}Type |
|
20 | %th{style: 'width: 10%'}Type |
|
12 | %th{style: 'width: 15%'} Value |
|
21 | %th{style: 'width: 15%'} Value |
|
13 | %th Description |
|
22 | %th Description |
|
14 | - @configurations.each do |conf| |
|
23 | - @configurations.each do |conf| |
|
15 | - next if conf.key[0...(conf.key.index('.'))] != g |
|
24 | - next if conf.key[0...(conf.key.index('.'))] != g |
|
16 | - @grader_configuration = conf |
|
25 | - @grader_configuration = conf |
|
17 | %tr |
|
26 | %tr |
|
18 | %td |
|
27 | %td |
|
19 | /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
28 | /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
20 | = @grader_configuration.key |
|
29 | = @grader_configuration.key |
|
21 | %td |
|
30 | %td |
|
22 | /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
31 | /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
23 | = @grader_configuration.value_type |
|
32 | = @grader_configuration.value_type |
|
24 | %td |
|
33 | %td |
|
25 | = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
34 | = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
26 | %td= conf.description |
|
35 | %td= conf.description |
|
27 |
|
36 | ||
|
|
37 | + .row | ||
|
|
38 | + .col-md-12 | ||
|
28 | - if GraderConfiguration.config_cached? |
|
39 | - if GraderConfiguration.config_cached? |
|
29 | %br/ |
|
40 | %br/ |
|
30 | Your config is saved, but it does not automatically take effect. |
|
41 | Your config is saved, but it does not automatically take effect. |
|
31 | %br/ |
|
42 | %br/ |
|
32 | If you have one mongrel process running, you can |
|
43 | If you have one mongrel process running, you can |
|
33 | = link_to '[click]', :action => 'reload' |
|
44 | = link_to '[click]', :action => 'reload' |
|
34 | here to reload. |
|
45 | here to reload. |
|
35 | %br/ |
|
46 | %br/ |
|
36 | If you have more than one process running, you should restart |
|
47 | If you have more than one process running, you should restart |
|
37 | them manually. |
|
48 | them manually. |
@@ -1,29 +1,29 | |||||
|
1 |
|
1 | ||
|
2 | /- if params[:id] |
|
2 | /- if params[:id] |
|
3 | / %h1 Tasks Hall of Fame |
|
3 | / %h1 Tasks Hall of Fame |
|
4 | / = link_to('[back to All-Time Hall of Fame]', action: 'problem_hof', id: nil ) |
|
4 | / = link_to('[back to All-Time Hall of Fame]', action: 'problem_hof', id: nil ) |
|
5 | /- else |
|
5 | /- else |
|
6 | / %h1 All-Time Hall of Fame |
|
6 | / %h1 All-Time Hall of Fame |
|
7 |
|
7 | ||
|
8 | .panel.panel-info |
|
8 | .panel.panel-info |
|
9 | .panel-heading |
|
9 | .panel-heading |
|
10 | Select Task |
|
10 | Select Task |
|
11 | .panel-body |
|
11 | .panel-body |
|
12 | .form-inline |
|
12 | .form-inline |
|
13 | = select 'report', |
|
13 | = select 'report', |
|
14 | 'problem_id', |
|
14 | 'problem_id', |
|
15 |
- @problems.collect {|p| ["[#{p.name}] #{p.full_name}", |
|
15 | + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", problem_hof_report_path(p)]}, |
|
16 |
- {:selected => |
|
16 | + {:selected => problem_hof_report_path(@problem)}, |
|
17 | { class: 'select2 form-control' } |
|
17 | { class: 'select2 form-control' } |
|
18 | %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go |
|
18 | %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go |
|
19 |
|
19 | ||
|
20 |
|
20 | ||
|
21 | - unless params[:id] |
|
21 | - unless params[:id] |
|
22 | /=render partial: 'all_time_hof' |
|
22 | /=render partial: 'all_time_hof' |
|
23 | Please select a problem. |
|
23 | Please select a problem. |
|
24 | - else |
|
24 | - else |
|
25 | %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
25 | %h1 [#{Problem.find(params[:id]).name}] #{Problem.find(params[:id]).full_name} |
|
26 | %h2 Submission History |
|
26 | %h2 Submission History |
|
27 | =render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
27 | =render partial: 'application/bar_graph', locals: { histogram: @histogram } |
|
28 | =render partial: 'task_hof' |
|
28 | =render partial: 'task_hof' |
|
29 |
|
29 |
@@ -44,49 +44,53 | |||||
|
44 | resources :groups do |
|
44 | resources :groups do |
|
45 | member do |
|
45 | member do |
|
46 | post 'add_user', to: 'groups#add_user', as: 'add_user' |
|
46 | post 'add_user', to: 'groups#add_user', as: 'add_user' |
|
47 | delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user' |
|
47 | delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user' |
|
48 | delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user' |
|
48 | delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user' |
|
49 | post 'add_problem', to: 'groups#add_problem', as: 'add_problem' |
|
49 | post 'add_problem', to: 'groups#add_problem', as: 'add_problem' |
|
50 | delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem' |
|
50 | delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem' |
|
51 | delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem' |
|
51 | delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem' |
|
52 | end |
|
52 | end |
|
53 | collection do |
|
53 | collection do |
|
54 |
|
54 | ||
|
55 | end |
|
55 | end |
|
56 | end |
|
56 | end |
|
57 |
|
57 | ||
|
58 | resources :testcases, only: [] do |
|
58 | resources :testcases, only: [] do |
|
59 | member do |
|
59 | member do |
|
60 | get 'download_input' |
|
60 | get 'download_input' |
|
61 | get 'download_sol' |
|
61 | get 'download_sol' |
|
62 | end |
|
62 | end |
|
63 | collection do |
|
63 | collection do |
|
64 | get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem' |
|
64 | get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem' |
|
65 | end |
|
65 | end |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 | - resources :grader_configuration, controller: 'configurations' |
|
68 | + resources :grader_configuration, controller: 'configurations' do |
|
|
69 | + collection do | ||
|
|
70 | + get 'set_exam_right(/:value)', action: 'set_exam_right', as: 'set_exam_right' | ||
|
|
71 | + end | ||
|
|
72 | + end | ||
|
69 |
|
73 | ||
|
70 | resources :users do |
|
74 | resources :users do |
|
71 | member do |
|
75 | member do |
|
72 | get 'toggle_activate', 'toggle_enable' |
|
76 | get 'toggle_activate', 'toggle_enable' |
|
73 | get 'stat' |
|
77 | get 'stat' |
|
74 | end |
|
78 | end |
|
75 | collection do |
|
79 | collection do |
|
76 | get 'profile' |
|
80 | get 'profile' |
|
77 | post 'chg_passwd' |
|
81 | post 'chg_passwd' |
|
78 | end |
|
82 | end |
|
79 | end |
|
83 | end |
|
80 |
|
84 | ||
|
81 | resources :submissions do |
|
85 | resources :submissions do |
|
82 | member do |
|
86 | member do |
|
83 | get 'download' |
|
87 | get 'download' |
|
84 | get 'compiler_msg' |
|
88 | get 'compiler_msg' |
|
85 | get 'rejudge' |
|
89 | get 'rejudge' |
|
86 | get 'source' |
|
90 | get 'source' |
|
87 | end |
|
91 | end |
|
88 | collection do |
|
92 | collection do |
|
89 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
93 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
90 | get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
94 | get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
91 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
95 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
92 | end |
|
96 | end |
@@ -113,49 +117,49 | |||||
|
113 | get 'clear_last_ip' |
|
117 | get 'clear_last_ip' |
|
114 | end |
|
118 | end |
|
115 | end |
|
119 | end |
|
116 |
|
120 | ||
|
117 | resources :contest_management, only: [:index] do |
|
121 | resources :contest_management, only: [:index] do |
|
118 | collection do |
|
122 | collection do |
|
119 | get 'user_stat' |
|
123 | get 'user_stat' |
|
120 | get 'clear_stat' |
|
124 | get 'clear_stat' |
|
121 | get 'clear_all_stat' |
|
125 | get 'clear_all_stat' |
|
122 | get 'change_contest_mode' |
|
126 | get 'change_contest_mode' |
|
123 | end |
|
127 | end |
|
124 | end |
|
128 | end |
|
125 |
|
129 | ||
|
126 | #get 'user_admin', to: 'user_admin#index' |
|
130 | #get 'user_admin', to: 'user_admin#index' |
|
127 | #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin' |
|
131 | #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin' |
|
128 | #post 'user_admin', to: 'user_admin#create' |
|
132 | #post 'user_admin', to: 'user_admin#create' |
|
129 | #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy' |
|
133 | #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy' |
|
130 |
|
134 | ||
|
131 | #singular resource |
|
135 | #singular resource |
|
132 | #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly |
|
136 | #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly |
|
133 | #report |
|
137 | #report |
|
134 | resource :report, only: [], controller: 'report' do |
|
138 | resource :report, only: [], controller: 'report' do |
|
135 | get 'login' |
|
139 | get 'login' |
|
136 | get 'multiple_login' |
|
140 | get 'multiple_login' |
|
137 | - get 'problem_hof/:id', action: 'problem_hof' |
|
141 | + get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof' |
|
138 | get 'current_score(/:group_id)', action: 'current_score', as: 'current_score' |
|
142 | get 'current_score(/:group_id)', action: 'current_score', as: 'current_score' |
|
139 | get 'max_score' |
|
143 | get 'max_score' |
|
140 | post 'show_max_score' |
|
144 | post 'show_max_score' |
|
141 | end |
|
145 | end |
|
142 | #get 'report/current_score', to: 'report#current_score', as: 'report_current_score' |
|
146 | #get 'report/current_score', to: 'report#current_score', as: 'report_current_score' |
|
143 | #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
147 | #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
144 | #get "report/login" |
|
148 | #get "report/login" |
|
145 | #get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
149 | #get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
146 | #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score' |
|
150 | #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score' |
|
147 |
|
151 | ||
|
148 | resource :main, only: [], controller: 'main' do |
|
152 | resource :main, only: [], controller: 'main' do |
|
149 | get 'login' |
|
153 | get 'login' |
|
150 | get 'logout' |
|
154 | get 'logout' |
|
151 | get 'list' |
|
155 | get 'list' |
|
152 | get 'submission(/:id)', action: 'submission', as: 'main_submission' |
|
156 | get 'submission(/:id)', action: 'submission', as: 'main_submission' |
|
153 | get 'announcements' |
|
157 | get 'announcements' |
|
154 | get 'help' |
|
158 | get 'help' |
|
155 | post 'submit' |
|
159 | post 'submit' |
|
156 | end |
|
160 | end |
|
157 | #main |
|
161 | #main |
|
158 | #get "main/list" |
|
162 | #get "main/list" |
|
159 | #get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
163 | #get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
160 | #post 'main/submit', to: 'main#submit' |
|
164 | #post 'main/submit', to: 'main#submit' |
|
161 | #get 'main/announcements', to: 'main#announcements' |
|
165 | #get 'main/announcements', to: 'main#announcements' |
You need to be logged in to leave comments.
Login now