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: 61 inserted, 36 deleted
@@ -21,12 +21,22 | |||||
|
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 | - %h1 System configuration |
|
4 | + .container-fluid |
|
|
5 | + .row | ||
|
|
6 | + .col-md-12 | ||
|
|
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| |
|
7 | - %h2= g |
|
14 | + .row |
|
8 | - %table.table.table-striped |
|
15 | + .col-md-12 |
|
9 | - %thead |
|
16 | + %h2= g |
|
10 | - %th{style: 'width: 25%'} Key |
|
17 | + %table.table.table-striped |
|
11 | - %th{style: 'width: 10%'}Type |
|
18 | + %thead |
|
12 |
- %th{style: 'width: |
|
19 | + %th{style: 'width: 25%'} Key |
|
13 | - %th Description |
|
20 | + %th{style: 'width: 10%'}Type |
|
14 | - - @configurations.each do |conf| |
|
21 | + %th{style: 'width: 15%'} Value |
|
15 | - - next if conf.key[0...(conf.key.index('.'))] != g |
|
22 | + %th Description |
|
16 |
- - @ |
|
23 | + - @configurations.each do |conf| |
|
17 | - %tr |
|
24 | + - next if conf.key[0...(conf.key.index('.'))] != g |
|
18 | - %td |
|
25 | + - @grader_configuration = conf |
|
19 | - /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
26 | + %tr |
|
20 | - = @grader_configuration.key |
|
27 | + %td |
|
21 | - %td |
|
28 | + /= in_place_editor_field :grader_configuration, :key, {}, :rows=>1 |
|
22 | - /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
29 | + = @grader_configuration.key |
|
23 | - = @grader_configuration.value_type |
|
30 | + %td |
|
24 | - %td |
|
31 | + /= in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1 |
|
25 | - = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" |
|
32 | + = @grader_configuration.value_type |
|
26 | - %td= conf.description |
|
33 | + %td |
|
|
34 | + = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel" | ||
|
|
35 | + %td= conf.description | ||
|
27 |
|
36 | ||
|
28 | - - if GraderConfiguration.config_cached? |
|
37 | + .row |
|
29 | - %br/ |
|
38 | + .col-md-12 |
|
30 | - Your config is saved, but it does not automatically take effect. |
|
39 | + - if GraderConfiguration.config_cached? |
|
31 | - %br/ |
|
40 | + %br/ |
|
32 | - If you have one mongrel process running, you can |
|
41 | + Your config is saved, but it does not automatically take effect. |
|
33 | - = link_to '[click]', :action => 'reload' |
|
42 | + %br/ |
|
34 | - here to reload. |
|
43 | + If you have one mongrel process running, you can |
|
35 | - %br/ |
|
44 | + = link_to '[click]', :action => 'reload' |
|
36 | - If you have more than one process running, you should restart |
|
45 | + here to reload. |
|
37 | - them manually. |
|
46 | + %br/ |
|
|
47 | + If you have more than one process running, you should restart | ||
|
|
48 | + them manually. |
@@ -9,14 +9,14 | |||||
|
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' |
@@ -62,13 +62,17 | |||||
|
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 |
@@ -131,13 +135,13 | |||||
|
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' |
You need to be logged in to leave comments.
Login now