Description:
Fix bug #23, #22, #21, #17
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r730:7917a0f3fcef - - 4 files changed: 4 inserted, 2 deleted

@@ -178,25 +178,25
178 end
178 end
179 @histogram[:summary][:max] = [@histogram[:data].max,1].max
179 @histogram[:summary][:max] = [@histogram[:data].max,1].max
180
180
181 @summary = { attempt: user.count, solve: 0 }
181 @summary = { attempt: user.count, solve: 0 }
182 user.each_value { |v| @summary[:solve] += 1 if v == 1 }
182 user.each_value { |v| @summary[:solve] += 1 if v == 1 }
183 end
183 end
184
184
185 def manage
185 def manage
186 @problems = Problem.order(date_added: :desc)
186 @problems = Problem.order(date_added: :desc)
187 end
187 end
188
188
189 def do_manage
189 def do_manage
190 - if params.has_key? 'change_date_added'
190 + if params.has_key? 'change_date_added' and params[:date_added].strip.empty? == false
191 change_date_added
191 change_date_added
192 elsif params.has_key? 'add_to_contest'
192 elsif params.has_key? 'add_to_contest'
193 add_to_contest
193 add_to_contest
194 elsif params.has_key? 'enable_problem'
194 elsif params.has_key? 'enable_problem'
195 set_available(true)
195 set_available(true)
196 elsif params.has_key? 'disable_problem'
196 elsif params.has_key? 'disable_problem'
197 set_available(false)
197 set_available(false)
198 elsif params.has_key? 'add_group'
198 elsif params.has_key? 'add_group'
199 group = Group.find(params[:group_id])
199 group = Group.find(params[:group_id])
200 ok = []
200 ok = []
201 failed = []
201 failed = []
202 get_problems_from_params.each do |p|
202 get_problems_from_params.each do |p|
@@ -34,25 +34,25
34 #process parameters
34 #process parameters
35 #problems
35 #problems
36 @problems = []
36 @problems = []
37 if params[:problem_id]
37 if params[:problem_id]
38 params[:problem_id].each do |id|
38 params[:problem_id].each do |id|
39 next unless id.strip != ""
39 next unless id.strip != ""
40 pid = Problem.find_by_id(id.to_i)
40 pid = Problem.find_by_id(id.to_i)
41 @problems << pid if pid
41 @problems << pid if pid
42 end
42 end
43 end
43 end
44
44
45 #users
45 #users
46 - @users = if params[:user] == "all" then
46 + @users = if params[:users] == "all" then
47 User.includes(:contests).includes(:contest_stat)
47 User.includes(:contests).includes(:contest_stat)
48 else
48 else
49 User.includes(:contests).includes(:contest_stat).where(enabled: true)
49 User.includes(:contests).includes(:contest_stat).where(enabled: true)
50 end
50 end
51
51
52 #set up range from param
52 #set up range from param
53 @since_id = params.fetch(:from_id, 0).to_i
53 @since_id = params.fetch(:from_id, 0).to_i
54 @until_id = params.fetch(:to_id, 0).to_i
54 @until_id = params.fetch(:to_id, 0).to_i
55 @since_id = nil if @since_id == 0
55 @since_id = nil if @since_id == 0
56 @until_id = nil if @until_id == 0
56 @until_id = nil if @until_id == 0
57
57
58 #calculate the routine
58 #calculate the routine
@@ -101,18 +101,19
101 %span.label.label-default= t.name
101 %span.label.label-default= t.name
102 %td= problem.available
102 %td= problem.available
103 %td= problem.date_added
103 %td= problem.date_added
104 - if GraderConfiguration.multicontests?
104 - if GraderConfiguration.multicontests?
105 %td
105 %td
106 - problem.contests.each do |contest|
106 - problem.contests.each do |contest|
107 = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])"
107 = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])"
108
108
109 :javascript
109 :javascript
110 $('.input-group.date').datetimepicker({
110 $('.input-group.date').datetimepicker({
111 format: 'DD/MMM/YYYY',
111 format: 'DD/MMM/YYYY',
112 showTodayButton: true,
112 showTodayButton: true,
113 + locale: 'en',
113 widgetPositioning: {horizontal: 'auto', vertical: 'bottom'},
114 widgetPositioning: {horizontal: 'auto', vertical: 'bottom'},
114
115
115 });
116 });
116 $('.datatable').DataTable({
117 $('.datatable').DataTable({
117 paging: false
118 paging: false
118 });
119 });
@@ -22,15 +22,16
22 .actions
22 .actions
23 = f.submit "Update", class: 'btn btn-primary'
23 = f.submit "Update", class: 'btn btn-primary'
24 .col-md-8
24 .col-md-8
25
25
26 = link_to 'Show', @site
26 = link_to 'Show', @site
27 |
27 |
28 = link_to 'Back', sites_path
28 = link_to 'Back', sites_path
29
29
30
30
31 :javascript
31 :javascript
32 $('.input-group.date').datetimepicker({
32 $('.input-group.date').datetimepicker({
33 format: 'DD/MMM/YYYY HH:mm',
33 format: 'DD/MMM/YYYY HH:mm',
34 + locale: 'en',
34 showTodayButton: true,
35 showTodayButton: true,
35 });
36 });
36
37
You need to be logged in to leave comments. Login now