Description:
still upgrading
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r753:9918c6e0c313 - - 6 files changed: 15 inserted, 6 deleted

@@ -45,56 +45,56
45 @problem.full_name = @problem.name if @problem.full_name == ''
45 @problem.full_name = @problem.name if @problem.full_name == ''
46 @problem.full_score = 100
46 @problem.full_score = 100
47 @problem.available = false
47 @problem.available = false
48 @problem.test_allowed = true
48 @problem.test_allowed = true
49 @problem.output_only = false
49 @problem.output_only = false
50 @problem.date_added = Time.new
50 @problem.date_added = Time.new
51 if @problem.save
51 if @problem.save
52 flash[:notice] = 'Problem was successfully created.'
52 flash[:notice] = 'Problem was successfully created.'
53 redirect_to action: :index
53 redirect_to action: :index
54 else
54 else
55 flash[:notice] = 'Error saving problem'
55 flash[:notice] = 'Error saving problem'
56 redirect_to action: :index
56 redirect_to action: :index
57 end
57 end
58 end
58 end
59
59
60 def edit
60 def edit
61 @problem = Problem.find(params[:id])
61 @problem = Problem.find(params[:id])
62 @description = @problem.description
62 @description = @problem.description
63 end
63 end
64
64
65 def update
65 def update
66 @problem = Problem.find(params[:id])
66 @problem = Problem.find(params[:id])
67 @description = @problem.description
67 @description = @problem.description
68 if @description.nil? and params[:description][:body]!=''
68 if @description.nil? and params[:description][:body]!=''
69 - @description = Description.new(params[:description])
69 + @description = Description.new(description_params)
70 if !@description.save
70 if !@description.save
71 flash[:notice] = 'Error saving description'
71 flash[:notice] = 'Error saving description'
72 render :action => 'edit' and return
72 render :action => 'edit' and return
73 end
73 end
74 @problem.description = @description
74 @problem.description = @description
75 elsif @description
75 elsif @description
76 - if !@description.update_attributes(params[:description])
76 + if !@description.update_attributes(description_params)
77 flash[:notice] = 'Error saving description'
77 flash[:notice] = 'Error saving description'
78 render :action => 'edit' and return
78 render :action => 'edit' and return
79 end
79 end
80 end
80 end
81 if params[:file] and params[:file].content_type != 'application/pdf'
81 if params[:file] and params[:file].content_type != 'application/pdf'
82 flash[:notice] = 'Error: Uploaded file is not PDF'
82 flash[:notice] = 'Error: Uploaded file is not PDF'
83 render :action => 'edit' and return
83 render :action => 'edit' and return
84 end
84 end
85 if @problem.update_attributes(problem_params)
85 if @problem.update_attributes(problem_params)
86 flash[:notice] = 'Problem was successfully updated.'
86 flash[:notice] = 'Problem was successfully updated.'
87 unless params[:file] == nil or params[:file] == ''
87 unless params[:file] == nil or params[:file] == ''
88 flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
88 flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
89 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
89 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
90 if not FileTest.exists? out_dirname
90 if not FileTest.exists? out_dirname
91 Dir.mkdir out_dirname
91 Dir.mkdir out_dirname
92 end
92 end
93
93
94 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
94 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
95 if FileTest.exists? out_filename
95 if FileTest.exists? out_filename
96 File.delete out_filename
96 File.delete out_filename
97 end
97 end
98
98
99 File.open(out_filename,"wb") do |file|
99 File.open(out_filename,"wb") do |file|
100 file.write(params[:file].read)
100 file.write(params[:file].read)
@@ -280,25 +280,29
280 p.save
280 p.save
281 end
281 end
282 end
282 end
283
283
284 def get_problems_from_params
284 def get_problems_from_params
285 problems = []
285 problems = []
286 params.keys.each do |k|
286 params.keys.each do |k|
287 if k.index('prob-')==0
287 if k.index('prob-')==0
288 name, id, order = k.split('-')
288 name, id, order = k.split('-')
289 problems << Problem.find(id)
289 problems << Problem.find(id)
290 end
290 end
291 end
291 end
292 problems
292 problems
293 end
293 end
294
294
295 def get_problems_stat
295 def get_problems_stat
296 end
296 end
297
297
298 private
298 private
299
299
300 def problem_params
300 def problem_params
301 params.require(:problem).permit(:name, :full_name, :full_score, :change_date_added, :date_added, :available, :test_allowed,:output_only, :url, :description, tag_ids:[])
301 params.require(:problem).permit(:name, :full_name, :full_score, :change_date_added, :date_added, :available, :test_allowed,:output_only, :url, :description, tag_ids:[])
302 end
302 end
303
303
304 + def description_params
305 + params.require(:description).permit(:body, :markdown)
304 end
306 end
307 +
308 + end
@@ -6,49 +6,49
6
6
7 class User < ActiveRecord::Base
7 class User < ActiveRecord::Base
8
8
9 has_and_belongs_to_many :roles
9 has_and_belongs_to_many :roles
10
10
11 #has_and_belongs_to_many :groups
11 #has_and_belongs_to_many :groups
12 has_many :groups_users, class_name: 'GroupUser'
12 has_many :groups_users, class_name: 'GroupUser'
13 has_many :groups, :through => :groups_users
13 has_many :groups, :through => :groups_users
14
14
15 has_many :test_requests, -> {order(submitted_at: :desc)}
15 has_many :test_requests, -> {order(submitted_at: :desc)}
16
16
17 has_many :messages, -> { order(created_at: :desc) },
17 has_many :messages, -> { order(created_at: :desc) },
18 :class_name => "Message",
18 :class_name => "Message",
19 :foreign_key => "sender_id"
19 :foreign_key => "sender_id"
20
20
21 has_many :replied_messages, -> { order(created_at: :desc) },
21 has_many :replied_messages, -> { order(created_at: :desc) },
22 :class_name => "Message",
22 :class_name => "Message",
23 :foreign_key => "receiver_id"
23 :foreign_key => "receiver_id"
24
24
25 has_one :contest_stat, :class_name => "UserContestStat", :dependent => :destroy
25 has_one :contest_stat, :class_name => "UserContestStat", :dependent => :destroy
26
26
27 belongs_to :site
27 belongs_to :site
28 belongs_to :country
28 belongs_to :country
29
29
30 - has_and_belongs_to_many :contests, -> { order(:name); uniq}
30 + has_and_belongs_to_many :contests, -> { order(:name)}
31
31
32 scope :activated_users, -> {where activated: true}
32 scope :activated_users, -> {where activated: true}
33
33
34 validates_presence_of :login
34 validates_presence_of :login
35 validates_uniqueness_of :login
35 validates_uniqueness_of :login
36 validates_format_of :login, :with => /\A[\_A-Za-z0-9]+\z/
36 validates_format_of :login, :with => /\A[\_A-Za-z0-9]+\z/
37 validates_length_of :login, :within => 3..30
37 validates_length_of :login, :within => 3..30
38
38
39 validates_presence_of :full_name
39 validates_presence_of :full_name
40 validates_length_of :full_name, :minimum => 1
40 validates_length_of :full_name, :minimum => 1
41
41
42 validates_presence_of :password, :if => :password_required?
42 validates_presence_of :password, :if => :password_required?
43 validates_length_of :password, :within => 4..20, :if => :password_required?
43 validates_length_of :password, :within => 4..20, :if => :password_required?
44 validates_confirmation_of :password, :if => :password_required?
44 validates_confirmation_of :password, :if => :password_required?
45
45
46 validates_format_of :email,
46 validates_format_of :email,
47 :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i,
47 :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i,
48 :if => :email_validation?
48 :if => :email_validation?
49 validate :uniqueness_of_email_from_activated_users,
49 validate :uniqueness_of_email_from_activated_users,
50 :if => :email_validation?
50 :if => :email_validation?
51 validate :enough_time_interval_between_same_email_registrations,
51 validate :enough_time_interval_between_same_email_registrations,
52 :if => :email_validation?
52 :if => :email_validation?
53
53
54 # these are for ytopc
54 # these are for ytopc
@@ -152,49 +152,49
152 if time_limit == nil
152 if time_limit == nil
153 return nil
153 return nil
154 end
154 end
155 if contest_stat==nil or contest_stat.started_at==nil
155 if contest_stat==nil or contest_stat.started_at==nil
156 return (Time.now.gmtime + time_limit) - Time.now.gmtime
156 return (Time.now.gmtime + time_limit) - Time.now.gmtime
157 else
157 else
158 finish_time = contest_stat.started_at + time_limit
158 finish_time = contest_stat.started_at + time_limit
159 current_time = Time.now.gmtime
159 current_time = Time.now.gmtime
160 if current_time > finish_time
160 if current_time > finish_time
161 return 0
161 return 0
162 else
162 else
163 return finish_time - current_time
163 return finish_time - current_time
164 end
164 end
165 end
165 end
166 else
166 else
167 return nil
167 return nil
168 end
168 end
169 end
169 end
170
170
171 def contest_finished?
171 def contest_finished?
172 if GraderConfiguration.contest_mode?
172 if GraderConfiguration.contest_mode?
173 return false if site==nil
173 return false if site==nil
174 return site.finished?
174 return site.finished?
175 elsif GraderConfiguration.indv_contest_mode?
175 elsif GraderConfiguration.indv_contest_mode?
176 - return false if self.contest_stat(true)==nil
176 + return false if self.contest_stat==nil
177 return contest_time_left == 0
177 return contest_time_left == 0
178 else
178 else
179 return false
179 return false
180 end
180 end
181 end
181 end
182
182
183 def contest_started?
183 def contest_started?
184 if GraderConfiguration.indv_contest_mode?
184 if GraderConfiguration.indv_contest_mode?
185 stat = self.contest_stat
185 stat = self.contest_stat
186 return ((stat != nil) and (stat.started_at != nil))
186 return ((stat != nil) and (stat.started_at != nil))
187 elsif GraderConfiguration.contest_mode?
187 elsif GraderConfiguration.contest_mode?
188 return true if site==nil
188 return true if site==nil
189 return site.started
189 return site.started
190 else
190 else
191 return true
191 return true
192 end
192 end
193 end
193 end
194
194
195 def update_start_time
195 def update_start_time
196 stat = self.contest_stat
196 stat = self.contest_stat
197 if stat.nil? or stat.started_at.nil?
197 if stat.nil? or stat.started_at.nil?
198 stat ||= UserContestStat.new(:user => self)
198 stat ||= UserContestStat.new(:user => self)
199 stat.started_at = Time.now.gmtime
199 stat.started_at = Time.now.gmtime
200 stat.save
200 stat.save
@@ -1,35 +1,36
1 - content_for :head do
1 - content_for :head do
2 = stylesheet_link_tag 'problems'
2 = stylesheet_link_tag 'problems'
3
3
4 %h1 Import problems
4 %h1 Import problems
5
5
6 %p= link_to '[Back to problem list]', problems_path
6 %p= link_to '[Back to problem list]', problems_path
7
7
8 - if @problem and @problem.errors
8 - if @problem and @problem.errors
9 =error_messages_for 'problem'
9 =error_messages_for 'problem'
10
10
11 - = form_tag({:action => 'do_import'}, :multipart => true) do
11 + = simple_form_for :problem, url: do_import_problems_path, :multipart => true do |f|
12 +
12 .submitbox
13 .submitbox
13 %table
14 %table
14 %tr
15 %tr
15 %td Name:
16 %td Name:
16 %td= text_field_tag 'name'
17 %td= text_field_tag 'name'
17 %tr
18 %tr
18 %td Full name:
19 %td Full name:
19 %td
20 %td
20 = text_field_tag 'full_name'
21 = text_field_tag 'full_name'
21 %span{:class => 'help'} Leave blank to use the same value as the name above.
22 %span{:class => 'help'} Leave blank to use the same value as the name above.
22 %tr
23 %tr
23 %td Testdata file:
24 %td Testdata file:
24 %td= file_field_tag 'file'
25 %td= file_field_tag 'file'
25 %tr
26 %tr
26 %td
27 %td
27 %td
28 %td
28 %span{:class => 'help'}
29 %span{:class => 'help'}
29 In .zip, .tgz, tar.gz, .tar format.
30 In .zip, .tgz, tar.gz, .tar format.
30 It should includes inputs (e.g., 1.in, 2a.in, 2b.in)
31 It should includes inputs (e.g., 1.in, 2a.in, 2b.in)
31 and solutions (e.g., 1.sol, 2a.sol, 2b.sol).
32 and solutions (e.g., 1.sol, 2a.sol, 2b.sol).
32 %br/
33 %br/
33 You may put task description in *.html for raw html
34 You may put task description in *.html for raw html
34 and *.md or *.markdown for markdown.
35 and *.md or *.markdown for markdown.
35 %br/
36 %br/
@@ -1,27 +1,27
1 %h1 Maximum score
1 %h1 Maximum score
2
2
3 - = form_tag report_show_max_score_path
3 + = form_tag show_max_score_report_path
4 .row
4 .row
5 .col-md-4
5 .col-md-4
6 .panel.panel-primary
6 .panel.panel-primary
7 .panel-heading
7 .panel-heading
8 Problems
8 Problems
9 .panel-body
9 .panel-body
10 %p
10 %p
11 Select problem(s) that we wish to know the score.
11 Select problem(s) that we wish to know the score.
12 = label_tag :problem_id, "Problems"
12 = label_tag :problem_id, "Problems"
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', @since_id, class: "form-control"
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"
@@ -30,48 +30,49
30 .input-group
30 .input-group
31 %span.input-group-btn
31 %span.input-group-btn
32 %span.btn.btn-default.btn-file
32 %span.btn.btn-default.btn-file
33 Browse
33 Browse
34 = file_field_tag 'load_file'
34 = file_field_tag 'load_file'
35 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
35 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
36 .form-group
36 .form-group
37 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
37 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
38 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
38 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
39 - # latest submission status
39 - # latest submission status
40 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
40 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
41 .panel-heading
41 .panel-heading
42 Latest Submission Status
42 Latest Submission Status
43 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
43 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
44 .panel-body
44 .panel-body
45 %div#latest_status
45 %div#latest_status
46 - if @submission
46 - if @submission
47 = render :partial => 'submission_short',
47 = render :partial => 'submission_short',
48 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
48 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
49 .row
49 .row
50 .col-md-12
50 .col-md-12
51 %h2 Console
51 %h2 Console
52 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
52 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
53
53
54 + - if @submission
54 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
55 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
55 .modal-dialog.modal-lg{role:'document'}
56 .modal-dialog.modal-lg{role:'document'}
56 .modal-content
57 .modal-content
57 .modal-header
58 .modal-header
58 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
59 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
59 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
60 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
60 %h4 Compiler message
61 %h4 Compiler message
61 .modal-body
62 .modal-body
62 %pre#compiler_msg= @submission.compiler_message
63 %pre#compiler_msg= @submission.compiler_message
63 .modal-footer
64 .modal-footer
64 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
65 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
65
66
66 :javascript
67 :javascript
67 $(document).ready(function() {
68 $(document).ready(function() {
68 e = ace.edit("editor")
69 e = ace.edit("editor")
69 e.setValue($("#text_sourcecode").val());
70 e.setValue($("#text_sourcecode").val());
70 e.gotoLine(1);
71 e.gotoLine(1);
71 $("#language_id").trigger('change');
72 $("#language_id").trigger('change');
72
73
73 $("#load_file").on('change',function(evt) {
74 $("#load_file").on('change',function(evt) {
74 var file = evt.target.files[0];
75 var file = evt.target.files[0];
75 var reader = new FileReader();
76 var reader = new FileReader();
76 reader.onload = function(theFile) {
77 reader.onload = function(theFile) {
77 var e = ace.edit("editor")
78 var e = ace.edit("editor")
@@ -19,123 +19,126
19 get 'console'
19 get 'console'
20 end
20 end
21 end
21 end
22
22
23 resources :announcements do
23 resources :announcements do
24 member do
24 member do
25 get 'toggle','toggle_front'
25 get 'toggle','toggle_front'
26 end
26 end
27 end
27 end
28
28
29 resources :problems do
29 resources :problems do
30 member do
30 member do
31 get 'toggle'
31 get 'toggle'
32 get 'toggle_test'
32 get 'toggle_test'
33 get 'toggle_view_testcase'
33 get 'toggle_view_testcase'
34 get 'stat'
34 get 'stat'
35 end
35 end
36 collection do
36 collection do
37 get 'turn_all_off'
37 get 'turn_all_off'
38 get 'turn_all_on'
38 get 'turn_all_on'
39 get 'import'
39 get 'import'
40 get 'manage'
40 get 'manage'
41 get 'quick_create'
41 get 'quick_create'
42 post 'do_manage'
42 post 'do_manage'
43 + post 'do_import'
43 end
44 end
44 end
45 end
45
46
46 resources :groups do
47 resources :groups do
47 member do
48 member do
48 post 'add_user', to: 'groups#add_user', as: 'add_user'
49 post 'add_user', to: 'groups#add_user', as: 'add_user'
49 delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user'
50 delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user'
50 delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user'
51 delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user'
51 post 'add_problem', to: 'groups#add_problem', as: 'add_problem'
52 post 'add_problem', to: 'groups#add_problem', as: 'add_problem'
52 delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem'
53 delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem'
53 delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem'
54 delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem'
54 end
55 end
55 collection do
56 collection do
56
57
57 end
58 end
58 end
59 end
59
60
60 resources :testcases, only: [] do
61 resources :testcases, only: [] do
61 member do
62 member do
62 get 'download_input'
63 get 'download_input'
63 get 'download_sol'
64 get 'download_sol'
64 end
65 end
65 collection do
66 collection do
66 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
67 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
67 end
68 end
68 end
69 end
69
70
70 resources :grader_configuration, controller: 'configurations'
71 resources :grader_configuration, controller: 'configurations'
71
72
72 resources :users do
73 resources :users do
73 member do
74 member do
74 get 'toggle_activate', 'toggle_enable'
75 get 'toggle_activate', 'toggle_enable'
75 get 'stat'
76 get 'stat'
76 end
77 end
77 end
78 end
78
79
79 resources :submissions do
80 resources :submissions do
80 member do
81 member do
81 get 'download'
82 get 'download'
82 get 'compiler_msg'
83 get 'compiler_msg'
83 get 'rejudge'
84 get 'rejudge'
85 + get 'source'
84 end
86 end
85 collection do
87 collection do
86 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
88 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
87 get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
89 get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
88 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
90 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
89 end
91 end
90 end
92 end
91
93
92
94
93 #user admin
95 #user admin
94 resources :user_admin do
96 resources :user_admin do
95 collection do
97 collection do
96 match 'bulk_manage', via: [:get, :post]
98 match 'bulk_manage', via: [:get, :post]
97 get 'bulk_mail'
99 get 'bulk_mail'
98 get 'user_stat'
100 get 'user_stat'
99 get 'import'
101 get 'import'
100 get 'new_list'
102 get 'new_list'
101 get 'admin'
103 get 'admin'
102 get 'active'
104 get 'active'
103 get 'mass_mailing'
105 get 'mass_mailing'
104 post 'grant_admin'
106 post 'grant_admin'
105 match 'create_from_list', via: [:get, :post]
107 match 'create_from_list', via: [:get, :post]
106 match 'random_all_passwords', via: [:get, :post]
108 match 'random_all_passwords', via: [:get, :post]
107 end
109 end
108 member do
110 member do
109 get 'clear_last_ip'
111 get 'clear_last_ip'
110 end
112 end
111 end
113 end
112
114
113 resources :contest_management, only: [:index] do
115 resources :contest_management, only: [:index] do
114 collection do
116 collection do
115 get 'user_stat'
117 get 'user_stat'
116 get 'clear_stat'
118 get 'clear_stat'
117 get 'clear_all_stat'
119 get 'clear_all_stat'
120 + get 'change_contest_mode'
118 end
121 end
119 end
122 end
120
123
121 #get 'user_admin', to: 'user_admin#index'
124 #get 'user_admin', to: 'user_admin#index'
122 #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
125 #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
123 #post 'user_admin', to: 'user_admin#create'
126 #post 'user_admin', to: 'user_admin#create'
124 #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy'
127 #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy'
125
128
126 #singular resource
129 #singular resource
127 #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly
130 #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly
128 #report
131 #report
129 resource :report, only: [], controller: 'report' do
132 resource :report, only: [], controller: 'report' do
130 get 'login'
133 get 'login'
131 get 'multiple_login'
134 get 'multiple_login'
132 get 'problem_hof/:id', action: 'problem_hof'
135 get 'problem_hof/:id', action: 'problem_hof'
133 get 'current_score'
136 get 'current_score'
134 get 'max_score'
137 get 'max_score'
135 post 'show_max_score'
138 post 'show_max_score'
136 end
139 end
137 #get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
140 #get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
138 #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
141 #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
139 #get "report/login"
142 #get "report/login"
140 #get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
143 #get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
141 #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
144 #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
You need to be logged in to leave comments. Login now