Description:
add autoset exam mode
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r765:3ce2a4681a0f - - 4 files changed: 29 inserted, 4 deleted

@@ -24,6 +24,16
24 24 end
25 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 37 private
28 38 def configuration_params
29 39 params.require(:grader_configuration).permit(:key,:value_type,:value,:description)
@@ -1,9 +1,18
1 1 /- content_for :header do
2 2 / = javascript_include_tag 'local_jquery'
3 3
4 + .container-fluid
5 + .row
6 + .col-md-12
4 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 13 - @group.each do |g|
14 + .row
15 + .col-md-12
7 16 %h2= g
8 17 %table.table.table-striped
9 18 %thead
@@ -25,6 +34,8
25 34 = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel"
26 35 %td= conf.description
27 36
37 + .row
38 + .col-md-12
28 39 - if GraderConfiguration.config_cached?
29 40 %br/
30 41 Your config is saved, but it does not automatically take effect.
@@ -12,8 +12,8
12 12 .form-inline
13 13 = select 'report',
14 14 'problem_id',
15 - @problems.collect {|p| ["[#{p.name}] #{p.full_name}", report_problem_hof_url(p.id)]},
16 - {:selected => report_problem_hof_url(@problem)},
15 + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", problem_hof_report_path(p)]},
16 + {:selected => problem_hof_report_path(@problem)},
17 17 { class: 'select2 form-control' }
18 18 %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: "#report_problem_id"}} Go
19 19
@@ -65,7 +65,11
65 65 end
66 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 74 resources :users do
71 75 member do
@@ -134,7 +138,7
134 138 resource :report, only: [], controller: 'report' do
135 139 get 'login'
136 140 get 'multiple_login'
137 - get 'problem_hof/:id', action: 'problem_hof'
141 + get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof'
138 142 get 'current_score(/:group_id)', action: 'current_score', as: 'current_score'
139 143 get 'max_score'
140 144 post 'show_max_score'
You need to be logged in to leave comments. Login now