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

r869:abb95edf0526 - - 5 files changed: 29 inserted, 30 deleted

@@ -30,155 +30,155
30 if !@description.save
30 if !@description.save
31 render :action => new and return
31 render :action => new and return
32 end
32 end
33 else
33 else
34 @description = nil
34 @description = nil
35 end
35 end
36 @problem.description = @description
36 @problem.description = @description
37 if @problem.save
37 if @problem.save
38 flash[:notice] = 'Problem was successfully created.'
38 flash[:notice] = 'Problem was successfully created.'
39 redirect_to action: :index
39 redirect_to action: :index
40 else
40 else
41 render :action => 'new'
41 render :action => 'new'
42 end
42 end
43 end
43 end
44
44
45 def quick_create
45 def quick_create
46 @problem = Problem.new(problem_params)
46 @problem = Problem.new(problem_params)
47 @problem.full_name = @problem.name if @problem.full_name == ''
47 @problem.full_name = @problem.name if @problem.full_name == ''
48 @problem.full_score = 100
48 @problem.full_score = 100
49 @problem.available = false
49 @problem.available = false
50 @problem.test_allowed = true
50 @problem.test_allowed = true
51 @problem.output_only = false
51 @problem.output_only = false
52 @problem.date_added = Time.new
52 @problem.date_added = Time.new
53 if @problem.save
53 if @problem.save
54 flash[:notice] = 'Problem was successfully created.'
54 flash[:notice] = 'Problem was successfully created.'
55 redirect_to action: :index
55 redirect_to action: :index
56 else
56 else
57 flash[:notice] = 'Error saving problem'
57 flash[:notice] = 'Error saving problem'
58 redirect_to action: :index
58 redirect_to action: :index
59 end
59 end
60 end
60 end
61
61
62 def edit
62 def edit
63 @problem = Problem.find(params[:id])
63 @problem = Problem.find(params[:id])
64 @description = @problem.description
64 @description = @problem.description
65 end
65 end
66
66
67 def update
67 def update
68 @problem = Problem.find(params[:id])
68 @problem = Problem.find(params[:id])
69 @description = @problem.description
69 @description = @problem.description
70 if @description.nil? and params[:description][:body]!=''
70 if @description.nil? and params[:description][:body]!=''
71 @description = Description.new(description_params)
71 @description = Description.new(description_params)
72 if !@description.save
72 if !@description.save
73 flash[:notice] = 'Error saving description'
73 flash[:notice] = 'Error saving description'
74 render :action => 'edit' and return
74 render :action => 'edit' and return
75 end
75 end
76 @problem.description = @description
76 @problem.description = @description
77 elsif @description
77 elsif @description
78 - if !@description.update_attributes(description_params)
78 + if !@description.update(description_params)
79 flash[:notice] = 'Error saving description'
79 flash[:notice] = 'Error saving description'
80 render :action => 'edit' and return
80 render :action => 'edit' and return
81 end
81 end
82 end
82 end
83 if params[:file] and params[:file].content_type != 'application/pdf'
83 if params[:file] and params[:file].content_type != 'application/pdf'
84 flash[:notice] = 'Error: Uploaded file is not PDF'
84 flash[:notice] = 'Error: Uploaded file is not PDF'
85 render :action => 'edit' and return
85 render :action => 'edit' and return
86 end
86 end
87 - if @problem.update_attributes(problem_params)
87 + if @problem.update(problem_params)
88 flash[:notice] = 'Problem was successfully updated.'
88 flash[:notice] = 'Problem was successfully updated.'
89 unless params[:file] == nil or params[:file] == ''
89 unless params[:file] == nil or params[:file] == ''
90 flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
90 flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
91 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
91 out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
92 if not FileTest.exists? out_dirname
92 if not FileTest.exists? out_dirname
93 Dir.mkdir out_dirname
93 Dir.mkdir out_dirname
94 end
94 end
95
95
96 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
96 out_filename = "#{out_dirname}/#{@problem.name}.pdf"
97 if FileTest.exists? out_filename
97 if FileTest.exists? out_filename
98 File.delete out_filename
98 File.delete out_filename
99 end
99 end
100
100
101 File.open(out_filename,"wb") do |file|
101 File.open(out_filename,"wb") do |file|
102 file.write(params[:file].read)
102 file.write(params[:file].read)
103 end
103 end
104 @problem.description_filename = "#{@problem.name}.pdf"
104 @problem.description_filename = "#{@problem.name}.pdf"
105 @problem.save
105 @problem.save
106 end
106 end
107 redirect_to :action => 'show', :id => @problem
107 redirect_to :action => 'show', :id => @problem
108 else
108 else
109 render :action => 'edit'
109 render :action => 'edit'
110 end
110 end
111 end
111 end
112
112
113 def destroy
113 def destroy
114 p = Problem.find(params[:id]).destroy
114 p = Problem.find(params[:id]).destroy
115 redirect_to action: :index
115 redirect_to action: :index
116 end
116 end
117
117
118 def toggle
118 def toggle
119 @problem = Problem.find(params[:id])
119 @problem = Problem.find(params[:id])
120 - @problem.update_attributes(available: !(@problem.available) )
120 + @problem.update(available: !(@problem.available) )
121 respond_to do |format|
121 respond_to do |format|
122 format.js { }
122 format.js { }
123 end
123 end
124 end
124 end
125
125
126 def toggle_test
126 def toggle_test
127 @problem = Problem.find(params[:id])
127 @problem = Problem.find(params[:id])
128 - @problem.update_attributes(test_allowed: !(@problem.test_allowed?) )
128 + @problem.update(test_allowed: !(@problem.test_allowed?) )
129 respond_to do |format|
129 respond_to do |format|
130 format.js { }
130 format.js { }
131 end
131 end
132 end
132 end
133
133
134 def toggle_view_testcase
134 def toggle_view_testcase
135 @problem = Problem.find(params[:id])
135 @problem = Problem.find(params[:id])
136 - @problem.update_attributes(view_testcase: !(@problem.view_testcase?) )
136 + @problem.update(view_testcase: !(@problem.view_testcase?) )
137 respond_to do |format|
137 respond_to do |format|
138 format.js { }
138 format.js { }
139 end
139 end
140 end
140 end
141
141
142 def turn_all_off
142 def turn_all_off
143 Problem.available.all.each do |problem|
143 Problem.available.all.each do |problem|
144 problem.available = false
144 problem.available = false
145 problem.save
145 problem.save
146 end
146 end
147 redirect_to action: :index
147 redirect_to action: :index
148 end
148 end
149
149
150 def turn_all_on
150 def turn_all_on
151 Problem.where.not(available: true).each do |problem|
151 Problem.where.not(available: true).each do |problem|
152 problem.available = true
152 problem.available = true
153 problem.save
153 problem.save
154 end
154 end
155 redirect_to action: :index
155 redirect_to action: :index
156 end
156 end
157
157
158 def stat
158 def stat
159 @problem = Problem.find(params[:id])
159 @problem = Problem.find(params[:id])
160 unless @problem.available or session[:admin]
160 unless @problem.available or session[:admin]
161 redirect_to :controller => 'main', :action => 'list'
161 redirect_to :controller => 'main', :action => 'list'
162 return
162 return
163 end
163 end
164 @submissions = Submission.includes(:user).includes(:language).where(problem_id: params[:id]).order(:user_id,:id)
164 @submissions = Submission.includes(:user).includes(:language).where(problem_id: params[:id]).order(:user_id,:id)
165
165
166 #stat summary
166 #stat summary
167 range =65
167 range =65
168 @histogram = { data: Array.new(range,0), summary: {} }
168 @histogram = { data: Array.new(range,0), summary: {} }
169 user = Hash.new(0)
169 user = Hash.new(0)
170 @submissions.find_each do |sub|
170 @submissions.find_each do |sub|
171 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
171 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
172 @histogram[:data][d.to_i] += 1 if d < range
172 @histogram[:data][d.to_i] += 1 if d < range
173 user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max
173 user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max
174 end
174 end
175 @histogram[:summary][:max] = [@histogram[:data].max,1].max
175 @histogram[:summary][:max] = [@histogram[:data].max,1].max
176
176
177 @summary = { attempt: user.count, solve: 0 }
177 @summary = { attempt: user.count, solve: 0 }
178 user.each_value { |v| @summary[:solve] += 1 if v == 1 }
178 user.each_value { |v| @summary[:solve] += 1 if v == 1 }
179 end
179 end
180
180
181 def manage
181 def manage
182 @problems = Problem.order(date_added: :desc)
182 @problems = Problem.order(date_added: :desc)
183 end
183 end
184
184
@@ -1,87 +1,87
1 %header
1 %header
2 %nav.navbar.fixed-top.navbar-dark.bg-primary.navbar-expand-lg
2 %nav.navbar.fixed-top.navbar-dark.bg-primary.navbar-expand-lg
3 .container-fluid
3 .container-fluid
4 %a.navbar-brand{href: list_main_path}
4 %a.navbar-brand{href: list_main_path}
5 %span.glyphicon.glyphicon-home
5 %span.glyphicon.glyphicon-home
6 MAIN
6 MAIN
7 %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} }
7 %button.navbar-toggler.collapsed{ type: :button, 'data-bs': {toggle: 'collapse', target: '#navbar-collapse'} }
8 %span.navbar-toggler-icon
8 %span.navbar-toggler-icon
9 .collapse.navbar-collapse#navbar-collapse
9 .collapse.navbar-collapse#navbar-collapse
10 %ul.navbar-nav.me-auto.mb-2.mb-lg-0
10 %ul.navbar-nav.me-auto.mb-2.mb-lg-0
11 / submission
11 / submission
12 - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user))
12 - if (@current_user!=nil) and (GraderConfiguration.show_tasks_to?(@current_user))
13 - %li.nav-item.dropdown
13 + %li.nav-item.dropdown.mx-2
14 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"}
14 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {expanded:"false"}, role: "button"}
15 = "#{I18n.t 'menu.submissions'}"
15 = "#{I18n.t 'menu.submissions'}"
16 %ul.dropdown-menu
16 %ul.dropdown-menu
17 %li= link_to 'View', submissions_path, class:'dropdown-item'
17 %li= link_to 'View', submissions_path, class:'dropdown-item'
18 %li= link_to 'Self Test', test_index_path, class:'dropdown-item'
18 %li= link_to 'Self Test', test_index_path, class:'dropdown-item'
19 / hall of fame
19 / hall of fame
20 - if GraderConfiguration['right.user_hall_of_fame']
20 - if GraderConfiguration['right.user_hall_of_fame']
21 - = add_menu("#{I18n.t 'menu.hall_of_fame'}", 'report', 'problem_hof', class: 'nav-item')
21 + %li= link_to "#{I18n.t 'menu.hall_of_fame'}", problem_hof_report_path, class: 'nav-link mx-2'
22 / display MODE button (with countdown in contest mode)
22 / display MODE button (with countdown in contest mode)
23 - if GraderConfiguration.analysis_mode?
23 - if GraderConfiguration.analysis_mode?
24 - %div.navbar-btn.btn.btn-success#countdown= "ANALYSIS MODE"
24 + %div.btn.btn-success#countdown= "ANALYSIS MODE"
25 - elsif GraderConfiguration.time_limit_mode?
25 - elsif GraderConfiguration.time_limit_mode?
26 - if @current_user.contest_finished?
26 - if @current_user.contest_finished?
27 - %div.navbar-btn.btn.btn-danger#countdown= "Contest is over"
27 + %div.btn.btn-danger#countdown= "Contest is over"
28 - elsif !@current_user.contest_started?
28 - elsif !@current_user.contest_started?
29 - %div.navbar-btn.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
29 + %div.btn.btn-primary#countdown= (t 'title_bar.contest_not_started')
30 - else
30 - else
31 - %div.navbar-btn.btn.btn-primary#countdown asdf
31 + %div.btn.btn-primary#countdown asdf
32 :javascript
32 :javascript
33 $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
33 $("#countdown").countdown({until: "+#{@current_user.contest_time_left.to_i}s", layout: 'Time left: {hnn}:{mnn}:{snn}'});
34 / admin section
34 / admin section
35 - if (@current_user!=nil) and (session[:admin])
35 - if (@current_user!=nil) and (session[:admin])
36 / management
36 / management
37 - %li.nav-item.dropdown
37 + %li.nav-item.dropdown.mx-2
38 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
38 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
39 Manage
39 Manage
40 %ul.dropdown-menu
40 %ul.dropdown-menu
41 %li= link_to 'Announcements', announcements_path, class: 'dropdown-item'
41 %li= link_to 'Announcements', announcements_path, class: 'dropdown-item'
42 %li= link_to 'Problems', problems_path, class: 'dropdown-item'
42 %li= link_to 'Problems', problems_path, class: 'dropdown-item'
43 %li= link_to 'Tags', tags_path, class: 'dropdown-item'
43 %li= link_to 'Tags', tags_path, class: 'dropdown-item'
44 %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item'
44 %li= link_to 'Users', user_admin_index_path, class: 'dropdown-item'
45 %li= link_to 'User Groups', groups_path, class: 'dropdown-item'
45 %li= link_to 'User Groups', groups_path, class: 'dropdown-item'
46 %li= link_to 'Graders', graders_list_path, class: 'dropdown-item'
46 %li= link_to 'Graders', graders_list_path, class: 'dropdown-item'
47 %li= link_to 'Message ', console_messages_path, class: 'dropdown-item'
47 %li= link_to 'Message ', console_messages_path, class: 'dropdown-item'
48 %li
48 %li
49 %hr.dropdown-divider
49 %hr.dropdown-divider
50 %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item'
50 %li= link_to 'System config', grader_configuration_index_path, class: 'dropdown-item'
51 %li
51 %li
52 %hr.dropdown-divider
52 %hr.dropdown-divider
53 %li= link_to 'Sites', sites_path, class: 'dropdown-item'
53 %li= link_to 'Sites', sites_path, class: 'dropdown-item'
54 %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item'
54 %li= link_to 'Contests', contest_management_index_path, class: 'dropdown-item'
55 -#
55 -#
56 / report
56 / report
57 - %li.nav-item.dropdown
57 + %li.nav-item.dropdown.mx-2
58 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
58 %a.nav-link.dropdown-toggle{href: '#', 'data-bs': {toggle:'dropdown'}, aria: {haspopup:"true", expanded:"false"}, role: "button"}
59 Report
59 Report
60 %ul.dropdown-menu
60 %ul.dropdown-menu
61 %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item'
61 %li= link_to 'Current Score', current_score_report_path, class: 'dropdown-item'
62 %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item'
62 %li= link_to 'Score Report', max_score_report_path, class: 'dropdown-item'
63 %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item'
63 %li= link_to 'Submission Report', submission_report_path, class: 'dropdown-item'
64 %li= link_to 'Login Report', login_report_path, class: 'dropdown-item'
64 %li= link_to 'Login Report', login_report_path, class: 'dropdown-item'
65 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
65 - if (ungraded = Submission.where('graded_at is null').where('submitted_at < ?', 1.minutes.ago).count) > 0
66 =link_to "#{ungraded} backlogs!",
66 =link_to "#{ungraded} backlogs!",
67 graders_list_path,
67 graders_list_path,
68 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
68 class: 'navbar-btn btn btn-default btn-warning', data: {toggle: 'tooltip'},title: 'Number of ungraded submission'
69 / announcement
69 / announcement
70 - @nav_announcement.each do |ann|
70 - @nav_announcement.each do |ann|
71 %p.navbar-text
71 %p.navbar-text
72 = ann.body.html_safe
72 = ann.body.html_safe
73 %ul.navbar-nav
73 %ul.navbar-nav
74 %li.nav-item
74 %li.nav-item
75 %a.nav-link{href: help_main_path}
75 %a.nav-link{href: help_main_path}
76 %span.mi.md-18 help
76 %span.mi.md-18 help
77 %li.nav-item
77 %li.nav-item
78 %a.nav-link{href: messages_path}
78 %a.nav-link{href: messages_path}
79 %span.mi.md-18 chat
79 %span.mi.md-18 chat
80 - if GraderConfiguration['system.user_setting_enabled']
80 - if GraderConfiguration['system.user_setting_enabled']
81 %li.nav-item
81 %li.nav-item
82 %a.nav-link{href: profile_users_path}
82 %a.nav-link{href: profile_users_path}
83 %span.mi.md-18 settings
83 %span.mi.md-18 settings
84 %li.nav-item
84 %li.nav-item
85 %a.nav-link{href: login_main_path}
85 %a.nav-link{href: login_main_path}
86 %span.mi.md-18 exit_to_app
86 %span.mi.md-18 exit_to_app
87 = @current_user.full_name
87 = @current_user.full_name
@@ -1,20 +1,19
1 - = form_tag({:action => 'submit'}, :multipart => true, class: 'form') do
1 + = form_with url: submit_main_path, multipart: true, class: 'form' do |form|
2 - if @submission and @submission.errors.any?
2 - if @submission and @submission.errors.any?
3 #error_explanation
3 #error_explanation
4 .alert.alert-danger
4 .alert.alert-danger
5 %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
5 %h3= "#{pluralize(@submission.errors.count, "error")} prohibited this user from being saved:"
6 %ul
6 %ul
7 - @submission.errors.full_messages.each do |msg|
7 - @submission.errors.full_messages.each do |msg|
8 %li= msg
8 %li= msg
9 - .form-group
9 + .row.mb-2
10 - = label_tag :submission, 'Problem:'
10 + .col-sm-2
11 + = form.label :submission, 'Problem:', class: 'form-label'
12 + .col-sm-10
11 = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" }
13 = select 'submission', 'problem_id', [[(t 'main.specified_in_header'),'-1']] + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", p.id]}, {:selected => '-1'}, { class: 'select2 form-control', style: "width: 100%" }
12 - .form-group
14 + .row.mb-2
13 - = label_tag :file, 'File:'
15 + .col-sm-2
14 - .input-group
16 + = form.label :file, 'File:', class: 'form-label'
15 - %span.input-group-btn
17 + .col-sm-10
16 - %span.btn.btn-default.btn-file
18 + = form.file_field :file, class: 'form-control'
17 - Browse
19 + = form.submit 'Submit', class: 'btn btn-primary'
18 - = file_field_tag 'file'
19 - = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
20 - = submit_tag 'Submit', class: 'btn btn-default'
@@ -1,68 +1,68
1 - content_for :head do
1 - content_for :head do
2 = javascript_include_tag "announcement_refresh"
2 = javascript_include_tag "announcement_refresh"
3
3
4 = user_title_bar(@user)
4 = user_title_bar(@user)
5 - if @user.section
5 - if @user.section
6 passcode for CP Unofficial Logo voting is
6 passcode for CP Unofficial Logo voting is
7 %strong= @user.section
7 %strong= @user.section
8 %br
8 %br
9
9
10 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
10 - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true)
11 %p=t 'main.start_soon'
11 %p=t 'main.start_soon'
12
12
13 .row
13 .row
14 .col-md-7
14 .col-md-7
15 - if GraderConfiguration.show_submitbox_to?(@user)
15 - if GraderConfiguration.show_submitbox_to?(@user)
16 - .panel.panel-primary
16 + .card.border-primary
17 - .panel-heading
17 + .card-header.text-bg-primary
18 Submission
18 Submission
19 - .panel-body
19 + .card-body
20 - = render :partial => 'submission_box'
20 + = render 'submission_box'
21 - if GraderConfiguration.show_tasks_to?(@user)
21 - if GraderConfiguration.show_tasks_to?(@user)
22 - if not GraderConfiguration.multicontests?
22 - if not GraderConfiguration.multicontests?
23 %table.table.table-striped.table-condensed
23 %table.table.table-striped.table-condensed
24 %thead
24 %thead
25 %tr
25 %tr
26 %th Task name
26 %th Task name
27 %th Full name
27 %th Full name
28 %th # of sub(s)
28 %th # of sub(s)
29 %th Results
29 %th Results
30 %th
30 %th
31 %tbody
31 %tbody
32 = render :partial => 'problem', :collection => @problems
32 = render :partial => 'problem', :collection => @problems
33 - else
33 - else
34 - @contest_problems.each do |cp|
34 - @contest_problems.each do |cp|
35 - if cp[:problems].length > 0
35 - if cp[:problems].length > 0
36 %h2{:class =>'contest-title'}
36 %h2{:class =>'contest-title'}
37 = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}"
37 = "#{cp[:contest] ? cp[:contest].title : 'Public problems'}"
38 %table.info
38 %table.info
39 %tr.info-head
39 %tr.info-head
40 %th Task name
40 %th Task name
41 %th Full name
41 %th Full name
42 %th # of sub(s)
42 %th # of sub(s)
43 %th Results
43 %th Results
44 %th
44 %th
45 = render :partial => 'problem', :collection => cp[:problems]
45 = render :partial => 'problem', :collection => cp[:problems]
46 .col-md-5
46 .col-md-5
47 .card
47 .card
48 .card-header
48 .card-header
49 Announcement
49 Announcement
50 = link_to 'Manage', announcements_path, class: 'btn btn-small'
50 = link_to 'Manage', announcements_path, class: 'btn btn-small'
51 .card-body
51 .card-body
52 = render :partial => 'announcement', :collection => @announcements
52 = render :partial => 'announcement', :collection => @announcements
53
53
54 %script{:type => 'text/javascript'}
54 %script{:type => 'text/javascript'}
55 = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
55 = "Announcement.refreshUrl = '#{url_for :controller => 'main', :action => 'announcements'}';"
56 Announcement.registerRefreshEventTimer();
56 Announcement.registerRefreshEventTimer();
57
57
58 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
58 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
59 .modal-dialog.modal-lg{role:'document'}
59 .modal-dialog.modal-lg{role:'document'}
60 .modal-content
60 .modal-content
61 .modal-header
61 .modal-header
62 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
62 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
63 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
63 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
64 %h4 Compiler message
64 %h4 Compiler message
65 .modal-body
65 .modal-body
66 %pre#compiler_msg
66 %pre#compiler_msg
67 .modal-footer
67 .modal-footer
68 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
68 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
@@ -1,49 +1,49
1 - %table.table.sortable.table-striped.table-bordered.table-condensed
1 + %table#score-table.table.sortable.table-striped.table-bordered.table-condensed
2 %thead
2 %thead
3 %tr
3 %tr
4 %th Login
4 %th Login
5 %th Name
5 %th Name
6 / %th Activated?
6 / %th Activated?
7 / %th Logged_in
7 / %th Logged_in
8 / %th Contest(s)
8 / %th Contest(s)
9 %th Remark
9 %th Remark
10 - @problems.each do |p|
10 - @problems.each do |p|
11 %th.text-right= p.name.gsub('_',' ')
11 %th.text-right= p.name.gsub('_',' ')
12 %th.text-right Total
12 %th.text-right Total
13 %th.text-right Passed
13 %th.text-right Passed
14 %tbody
14 %tbody
15 - sum = Array.new(@problems.count+1,0)
15 - sum = Array.new(@problems.count+1,0)
16 - nonzero = Array.new(@problems.count+1,0)
16 - nonzero = Array.new(@problems.count+1,0)
17 - full = Array.new(@problems.count+1,0)
17 - full = Array.new(@problems.count+1,0)
18 - @scorearray.each do |sc|
18 - @scorearray.each do |sc|
19 %tr
19 %tr
20 - total,num_passed = 0,0
20 - total,num_passed = 0,0
21 - sc.each_index do |i|
21 - sc.each_index do |i|
22 - if i == 0
22 - if i == 0
23 %td= link_to sc[i].login, stat_user_path(sc[i])
23 %td= link_to sc[i].login, stat_user_path(sc[i])
24 %td= sc[i].full_name
24 %td= sc[i].full_name
25 / %td= sc[i].activated
25 / %td= sc[i].activated
26 / %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no'
26 / %td= sc[i].try(:contest_stat).try(:started_at) ? 'yes' : 'no'
27 / %td= sc[i].contests.collect {|c| c.name}.join(', ')
27 / %td= sc[i].contests.collect {|c| c.name}.join(', ')
28 %td= sc[i].remark
28 %td= sc[i].remark
29 - else
29 - else
30 %td.text-right= sc[i][0]
30 %td.text-right= sc[i][0]
31 - total += sc[i][0]
31 - total += sc[i][0]
32 - num_passed += 1 if sc[i][1]
32 - num_passed += 1 if sc[i][1]
33 - sum[i] += sc[i][0]
33 - sum[i] += sc[i][0]
34 - nonzero[i] += 1 if sc[i][0] > 0
34 - nonzero[i] += 1 if sc[i][0] > 0
35 - full[i] += 1 if sc[i][1]
35 - full[i] += 1 if sc[i][1]
36 %td.text-right= total
36 %td.text-right= total
37 %td.text-right= num_passed
37 %td.text-right= num_passed
38 %tfoot
38 %tfoot
39 %tr
39 %tr
40 %td Summation
40 %td Summation
41 %td
41 %td
42 %td
42 %td
43 - sum.each.with_index do |s,i|
43 - sum.each.with_index do |s,i|
44 - next if i == 0
44 - next if i == 0
45 %td.text-right= number_with_delimiter(s)
45 %td.text-right= number_with_delimiter(s)
46 %td
46 %td
47 %td
47 %td
48 %tr
48 %tr
49 %td partial solver
49 %td partial solver
You need to be logged in to leave comments. Login now