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

r512:4a0989b96ef2 - - 8 files changed: 35 inserted, 4 deleted

@@ -35,83 +35,84
35 end
35 end
36
36
37 def clear
37 def clear
38 grader_proc = GraderProcess.find(params[:id])
38 grader_proc = GraderProcess.find(params[:id])
39 grader_proc.destroy if grader_proc!=nil
39 grader_proc.destroy if grader_proc!=nil
40 redirect_to :action => 'list'
40 redirect_to :action => 'list'
41 end
41 end
42
42
43 def clear_terminated
43 def clear_terminated
44 GraderProcess.find_terminated_graders.each do |p|
44 GraderProcess.find_terminated_graders.each do |p|
45 p.destroy
45 p.destroy
46 end
46 end
47 redirect_to :action => 'list'
47 redirect_to :action => 'list'
48 end
48 end
49
49
50 def clear_all
50 def clear_all
51 GraderProcess.find(:all).each do |p|
51 GraderProcess.find(:all).each do |p|
52 p.destroy
52 p.destroy
53 end
53 end
54 redirect_to :action => 'list'
54 redirect_to :action => 'list'
55 end
55 end
56
56
57 def view
57 def view
58 if params[:type]=='Task'
58 if params[:type]=='Task'
59 redirect_to :action => 'task', :id => params[:id]
59 redirect_to :action => 'task', :id => params[:id]
60 else
60 else
61 redirect_to :action => 'test_request', :id => params[:id]
61 redirect_to :action => 'test_request', :id => params[:id]
62 end
62 end
63 end
63 end
64
64
65 def test_request
65 def test_request
66 @test_request = TestRequest.find(params[:id])
66 @test_request = TestRequest.find(params[:id])
67 end
67 end
68
68
69 def task
69 def task
70 @task = Task.find(params[:id])
70 @task = Task.find(params[:id])
71 end
71 end
72
72
73 def submission
73 def submission
74 @submission = Submission.find(params[:id])
74 @submission = Submission.find(params[:id])
75 formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true )
75 formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true )
76 lexer = case @submission.language.name
76 lexer = case @submission.language.name
77 when "c" then Rouge::Lexers::C.new
77 when "c" then Rouge::Lexers::C.new
78 when "cpp" then Rouge::Lexers::Cpp.new
78 when "cpp" then Rouge::Lexers::Cpp.new
79 when "pas" then Rouge::Lexers::Pas.new
79 when "pas" then Rouge::Lexers::Pas.new
80 when "ruby" then Rouge::Lexers::Ruby.new
80 when "ruby" then Rouge::Lexers::Ruby.new
81 when "python" then Rouge::Lexers::Python.new
81 when "python" then Rouge::Lexers::Python.new
82 when "java" then Rouge::Lexers::Java.new
82 when "java" then Rouge::Lexers::Java.new
83 + when "php" then Rouge::Lexers::PHP.new
83 end
84 end
84 @formatted_code = formatter.format(lexer.lex(@submission.source))
85 @formatted_code = formatter.format(lexer.lex(@submission.source))
85 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
86 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
86
87
87 end
88 end
88
89
89 # various grader controls
90 # various grader controls
90
91
91 def stop
92 def stop
92 grader_proc = GraderProcess.find(params[:id])
93 grader_proc = GraderProcess.find(params[:id])
93 GraderScript.stop_grader(grader_proc.pid)
94 GraderScript.stop_grader(grader_proc.pid)
94 flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.'
95 flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.'
95 redirect_to :action => 'list'
96 redirect_to :action => 'list'
96 end
97 end
97
98
98 def stop_all
99 def stop_all
99 GraderScript.stop_graders(GraderProcess.find_running_graders +
100 GraderScript.stop_graders(GraderProcess.find_running_graders +
100 GraderProcess.find_stalled_process)
101 GraderProcess.find_stalled_process)
101 flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.'
102 flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.'
102 redirect_to :action => 'list'
103 redirect_to :action => 'list'
103 end
104 end
104
105
105 def start_grading
106 def start_grading
106 GraderScript.start_grader('grading')
107 GraderScript.start_grader('grading')
107 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
108 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
108 redirect_to :action => 'list'
109 redirect_to :action => 'list'
109 end
110 end
110
111
111 def start_exam
112 def start_exam
112 GraderScript.start_grader('exam')
113 GraderScript.start_grader('exam')
113 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
114 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
114 redirect_to :action => 'list'
115 redirect_to :action => 'list'
115 end
116 end
116
117
117 end
118 end
@@ -44,98 +44,120
44 end
44 end
45 @problem.description = @description
45 @problem.description = @description
46 if @problem.save
46 if @problem.save
47 flash[:notice] = 'Problem was successfully created.'
47 flash[:notice] = 'Problem was successfully created.'
48 redirect_to :action => 'list'
48 redirect_to :action => 'list'
49 else
49 else
50 render :action => 'new'
50 render :action => 'new'
51 end
51 end
52 end
52 end
53
53
54 def quick_create
54 def quick_create
55 @problem = Problem.new(params[:problem])
55 @problem = Problem.new(params[:problem])
56 @problem.full_name = @problem.name if @problem.full_name == ''
56 @problem.full_name = @problem.name if @problem.full_name == ''
57 @problem.full_score = 100
57 @problem.full_score = 100
58 @problem.available = false
58 @problem.available = false
59 @problem.test_allowed = true
59 @problem.test_allowed = true
60 @problem.output_only = false
60 @problem.output_only = false
61 @problem.date_added = Time.new
61 @problem.date_added = Time.new
62 if @problem.save
62 if @problem.save
63 flash[:notice] = 'Problem was successfully created.'
63 flash[:notice] = 'Problem was successfully created.'
64 redirect_to :action => 'list'
64 redirect_to :action => 'list'
65 else
65 else
66 flash[:notice] = 'Error saving problem'
66 flash[:notice] = 'Error saving problem'
67 redirect_to :action => 'list'
67 redirect_to :action => 'list'
68 end
68 end
69 end
69 end
70
70
71 def edit
71 def edit
72 @problem = Problem.find(params[:id])
72 @problem = Problem.find(params[:id])
73 @description = @problem.description
73 @description = @problem.description
74 end
74 end
75
75
76 def update
76 def update
77 @problem = Problem.find(params[:id])
77 @problem = Problem.find(params[:id])
78 @description = @problem.description
78 @description = @problem.description
79 if @description == nil and params[:description][:body]!=''
79 if @description == nil and params[:description][:body]!=''
80 @description = Description.new(params[:description])
80 @description = Description.new(params[:description])
81 if !@description.save
81 if !@description.save
82 flash[:notice] = 'Error saving description'
82 flash[:notice] = 'Error saving description'
83 render :action => 'edit' and return
83 render :action => 'edit' and return
84 end
84 end
85 @problem.description = @description
85 @problem.description = @description
86 elsif @description!=nil
86 elsif @description!=nil
87 if !@description.update_attributes(params[:description])
87 if !@description.update_attributes(params[:description])
88 flash[:notice] = 'Error saving description'
88 flash[:notice] = 'Error saving description'
89 render :action => 'edit' and return
89 render :action => 'edit' and return
90 end
90 end
91 end
91 end
92 + if params[:file] and params[:file].content_type != 'application/pdf'
93 + flash[:notice] = 'Error: Uploaded file is not PDF'
94 + render :action => 'edit' and return
95 + end
92 if @problem.update_attributes(params[:problem])
96 if @problem.update_attributes(params[:problem])
93 flash[:notice] = 'Problem was successfully updated.'
97 flash[:notice] = 'Problem was successfully updated.'
98 + unless params[:file] == nil or params[:file] == ''
99 + flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
100 + out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
101 + if not FileTest.exists? out_dirname
102 + Dir.mkdir out_dirname
103 + end
104 +
105 + out_filename = "#{out_dirname}/#{@problem.name}.pdf"
106 + if FileTest.exists? out_filename
107 + File.delete out_filename
108 + end
109 +
110 + File.open(out_filename,"wb") do |file|
111 + file.write(params[:file].read)
112 + end
113 + @problem.description_filename = "#{@problem.name}.pdf"
114 + @problem.save
115 + end
94 redirect_to :action => 'show', :id => @problem
116 redirect_to :action => 'show', :id => @problem
95 else
117 else
96 render :action => 'edit'
118 render :action => 'edit'
97 end
119 end
98 end
120 end
99
121
100 def destroy
122 def destroy
101 Problem.find(params[:id]).destroy
123 Problem.find(params[:id]).destroy
102 redirect_to :action => 'list'
124 redirect_to :action => 'list'
103 end
125 end
104
126
105 def toggle
127 def toggle
106 @problem = Problem.find(params[:id])
128 @problem = Problem.find(params[:id])
107 @problem.available = !(@problem.available)
129 @problem.available = !(@problem.available)
108 @problem.save
130 @problem.save
109 end
131 end
110
132
111 def turn_all_off
133 def turn_all_off
112 Problem.find(:all,
134 Problem.find(:all,
113 :conditions => "available = 1").each do |problem|
135 :conditions => "available = 1").each do |problem|
114 problem.available = false
136 problem.available = false
115 problem.save
137 problem.save
116 end
138 end
117 redirect_to :action => 'list'
139 redirect_to :action => 'list'
118 end
140 end
119
141
120 def turn_all_on
142 def turn_all_on
121 Problem.find(:all,
143 Problem.find(:all,
122 :conditions => "available = 0").each do |problem|
144 :conditions => "available = 0").each do |problem|
123 problem.available = true
145 problem.available = true
124 problem.save
146 problem.save
125 end
147 end
126 redirect_to :action => 'list'
148 redirect_to :action => 'list'
127 end
149 end
128
150
129 def stat
151 def stat
130 @problem = Problem.find(params[:id])
152 @problem = Problem.find(params[:id])
131 if !@problem.available
153 if !@problem.available
132 redirect_to :controller => 'main', :action => 'list'
154 redirect_to :controller => 'main', :action => 'list'
133 else
155 else
134 @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id)
156 @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id)
135 end
157 end
136 end
158 end
137
159
138 def manage
160 def manage
139 @problems = Problem.find(:all, :order => 'date_added DESC')
161 @problems = Problem.find(:all, :order => 'date_added DESC')
140 end
162 end
141
163
@@ -1,18 +1,20
1
1
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
3 %td.info{:align => "center"}
3 %td.info{:align => "center"}
4 = submission_counter+1
4 = submission_counter+1
5 + %td.info{:align => "center"}
6 + = link_to "##{submission.id}", controller: :graders, action: :submission, id: submission.id
5 %td.info= format_short_time(submission.submitted_at)
7 %td.info= format_short_time(submission.submitted_at)
6 %td.info{:align => "center"}
8 %td.info{:align => "center"}
7 = link_to('[load]',{:action => 'source', :id => submission.id})
9 = link_to('[load]',{:action => 'source', :id => submission.id})
8 %td.info
10 %td.info
9 - if submission.graded_at!=nil
11 - if submission.graded_at!=nil
10 = "Graded at #{format_short_time(submission.graded_at)}."
12 = "Graded at #{format_short_time(submission.graded_at)}."
11 %br/
13 %br/
12 = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score']
14 = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score']
13 = " ["
15 = " ["
14 %tt
16 %tt
15 = submission.grader_comment
17 = submission.grader_comment
16 = "]"
18 = "]"
17 %td.info
19 %td.info
18 = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message }
20 = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message }
@@ -1,24 +1,25
1 = user_title_bar(@user)
1 = user_title_bar(@user)
2
2
3 .task-menu
3 .task-menu
4 Task List
4 Task List
5 %br/
5 %br/
6 - @problems.each do |problem|
6 - @problems.each do |problem|
7 = link_to problem.name, :action => 'submission', :id => problem.name
7 = link_to problem.name, :action => 'submission', :id => problem.name
8
8
9 - if @problem!=nil
9 - if @problem!=nil
10 %h2= "Task: #{@problem.full_name} (#{@problem.name})"
10 %h2= "Task: #{@problem.full_name} (#{@problem.name})"
11
11
12 - if @submissions!=nil
12 - if @submissions!=nil
13 - if @submissions.length>0
13 - if @submissions.length>0
14 %table.info
14 %table.info
15 %tr.info-head
15 %tr.info-head
16 + %th.info No.
16 %th.info #
17 %th.info #
17 %th.info At
18 %th.info At
18 %th.info Source
19 %th.info Source
19 %th.info Result
20 %th.info Result
20 %th.info{:width => "300px"}
21 %th.info{:width => "300px"}
21 Compiler message
22 Compiler message
22 = render :partial => 'submission', :collection => @submissions
23 = render :partial => 'submission', :collection => @submissions
23 - else
24 - else
24 No submission
25 No submission
@@ -3,50 +3,52
3 <!--[form:problem]-->
3 <!--[form:problem]-->
4 <p><label for="problem_name">Name</label><br/>
4 <p><label for="problem_name">Name</label><br/>
5 <%= text_field 'problem', 'name' %></p>
5 <%= text_field 'problem', 'name' %></p>
6
6
7 <p><label for="problem_full_name">Full name</label><br/>
7 <p><label for="problem_full_name">Full name</label><br/>
8 <%= text_field 'problem', 'full_name' %></p>
8 <%= text_field 'problem', 'full_name' %></p>
9
9
10 <p><label for="problem_full_score">Full score</label><br/>
10 <p><label for="problem_full_score">Full score</label><br/>
11 <%= text_field 'problem', 'full_score' %></p>
11 <%= text_field 'problem', 'full_score' %></p>
12
12
13 <p><label for="problem_date_added">Date added</label><br/>
13 <p><label for="problem_date_added">Date added</label><br/>
14 <%= date_select 'problem', 'date_added' %></p>
14 <%= date_select 'problem', 'date_added' %></p>
15
15
16 <%
16 <%
17 # TODO: these should be put in model Problem, but I can't think of
17 # TODO: these should be put in model Problem, but I can't think of
18 # nice default values for them. These values look fine only
18 # nice default values for them. These values look fine only
19 # in this case (of lazily adding new problems).
19 # in this case (of lazily adding new problems).
20 @problem.available = true if @problem!=nil and @problem.available==nil
20 @problem.available = true if @problem!=nil and @problem.available==nil
21 @problem.test_allowed = true if @problem!=nil and @problem.test_allowed==nil
21 @problem.test_allowed = true if @problem!=nil and @problem.test_allowed==nil
22 @problem.output_only = false if @problem!=nil and @problem.output_only==nil
22 @problem.output_only = false if @problem!=nil and @problem.output_only==nil
23 %>
23 %>
24
24
25 <p>
25 <p>
26 <label for="problem_available">Available?</label>
26 <label for="problem_available">Available?</label>
27 <%= check_box :problem, :available %>
27 <%= check_box :problem, :available %>
28
28
29 <label for="problem_test_allowed">Test allowed?</label>
29 <label for="problem_test_allowed">Test allowed?</label>
30 <%= check_box :problem, :test_allowed %>
30 <%= check_box :problem, :test_allowed %>
31
31
32 <label for="problem_output_only">Output only?</label>
32 <label for="problem_output_only">Output only?</label>
33 <%= check_box :problem, :output_only %>
33 <%= check_box :problem, :output_only %>
34 </p>
34 </p>
35
35
36 <%= error_messages_for 'description' %>
36 <%= error_messages_for 'description' %>
37
37
38 <p><label for="description_body">Description</label><br/>
38 <p><label for="description_body">Description</label><br/>
39 <%= text_area :description, :body, :rows => 10, :cols => 80 %></p>
39 <%= text_area :description, :body, :rows => 10, :cols => 80 %></p>
40
40
41 <p><label for="description_markdowned">Markdowned?</label>
41 <p><label for="description_markdowned">Markdowned?</label>
42 <%= select "description",
42 <%= select "description",
43 "markdowned",
43 "markdowned",
44 [['True',true],['False',false]],
44 [['True',true],['False',false]],
45 {:selected => (@description) ? @description.markdowned : false }
45 {:selected => (@description) ? @description.markdowned : false }
46 %></p>
46 %></p>
47
47
48 <p><label for="problem_url">URL</label><br/>
48 <p><label for="problem_url">URL</label><br/>
49 <%= text_field 'problem', 'url' %></p>
49 <%= text_field 'problem', 'url' %></p>
50
50
51 + <p>Task PDF <%= file_field_tag 'file' %></p>
52 +
51
53
52 <!--[eoform:problem]-->
54 <!--[eoform:problem]-->
@@ -1,9 +1,9
1 <h1>Editing problem</h1>
1 <h1>Editing problem</h1>
2
2
3 - <%= form_tag :action => 'update', :id => @problem do %>
3 + <%= form_tag({action: 'update', id: @problem},multipart: true) do %>
4 <%= render :partial => 'form' %>
4 <%= render :partial => 'form' %>
5 <%= submit_tag 'Edit' %>
5 <%= submit_tag 'Edit' %>
6 <% end %>
6 <% end %>
7
7
8 <%= link_to 'Show', :action => 'show', :id => @problem %> |
8 <%= link_to 'Show', :action => 'show', :id => @problem %> |
9 <%= link_to 'Back', :action => 'list' %>
9 <%= link_to 'Back', :action => 'list' %>
@@ -23,64 +23,65
23 <% end %>
23 <% end %>
24 <br/>
24 <br/>
25 <b>Import from site management</b>
25 <b>Import from site management</b>
26 <%= form_tag({:action => 'import'}, :multipart => true) do %>
26 <%= form_tag({:action => 'import'}, :multipart => true) do %>
27 File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %>
27 File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %>
28 <% end %>
28 <% end %>
29 <br/>
29 <br/>
30 <b>What else: </b>
30 <b>What else: </b>
31 <%= link_to '[New user]', :action => 'new' %>
31 <%= link_to '[New user]', :action => 'new' %>
32 <%= link_to '[New list of users]', :action => 'new_list' %>
32 <%= link_to '[New list of users]', :action => 'new_list' %>
33 <%= link_to '[View administrators]', :action => 'admin' %>
33 <%= link_to '[View administrators]', :action => 'admin' %>
34 <%= link_to '[Random passwords]', :action => 'random_all_passwords' %>
34 <%= link_to '[Random passwords]', :action => 'random_all_passwords' %>
35 <%= link_to '[View active users]', :action => 'active' %>
35 <%= link_to '[View active users]', :action => 'active' %>
36 <%= link_to '[Mass mailing]', :action => 'mass_mailing' %>
36 <%= link_to '[Mass mailing]', :action => 'mass_mailing' %>
37 <% if GraderConfiguration.multicontests? %>
37 <% if GraderConfiguration.multicontests? %>
38 <br/><b>Multi-contest:</b>
38 <br/><b>Multi-contest:</b>
39 <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %>
39 <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %>
40 View users in:
40 View users in:
41 <% @contests.each do |contest| %>
41 <% @contests.each do |contest| %>
42 <%= link_to "[#{contest.name}]", :action => 'contests', :id => contest.id %>
42 <%= link_to "[#{contest.name}]", :action => 'contests', :id => contest.id %>
43 <% end %>
43 <% end %>
44 <%= link_to "[no contest]", :action => 'contests', :id => 'none' %>
44 <%= link_to "[no contest]", :action => 'contests', :id => 'none' %>
45 <% end %>
45 <% end %>
46 </div>
46 </div>
47
47
48 Total <%= @user_count %> users |
48 Total <%= @user_count %> users |
49 <% if !@paginated %>
49 <% if !@paginated %>
50 Display all users.
50 Display all users.
51 <%= link_to '[show in pages]', :action => 'list', :page => '1' %>
51 <%= link_to '[show in pages]', :action => 'list', :page => '1' %>
52 <% else %>
52 <% else %>
53 Display in pages.
53 Display in pages.
54 <%= link_to '[display all]', :action => 'list', :page => 'all' %> |
54 <%= link_to '[display all]', :action => 'list', :page => 'all' %> |
55 <%= will_paginate @users, :container => false %>
55 <%= will_paginate @users, :container => false %>
56 <% end %>
56 <% end %>
57 <table class="info">
57 <table class="info">
58 <tr class="info-head">
58 <tr class="info-head">
59 <% for column in User.content_columns %>
59 <% for column in User.content_columns %>
60 <% if !@hidden_columns.index(column.name) %>
60 <% if !@hidden_columns.index(column.name) %>
61 <th><%= column.human_name %></th>
61 <th><%= column.human_name %></th>
62 <% end %>
62 <% end %>
63 <% end %>
63 <% end %>
64 <th></th>
64 <th></th>
65 <th></th>
65 <th></th>
66 <th></th>
66 <th></th>
67 </tr>
67 </tr>
68
68
69 <% for user in @users %>
69 <% for user in @users %>
70 <tr class="info-<%= cycle("odd","even") %>">
70 <tr class="info-<%= cycle("odd","even") %>">
71 + <td><%= link_to user.login, controller: :users, :action => 'profile', :id => user %></td>
71 <% for column in User.content_columns %>
72 <% for column in User.content_columns %>
72 - <% if !@hidden_columns.index(column.name) %>
73 + <% if !@hidden_columns.index(column.name) and column.name != 'login' %>
73 <td><%=h user.send(column.name) %></td>
74 <td><%=h user.send(column.name) %></td>
74 <% end %>
75 <% end %>
75 <% end %>
76 <% end %>
76 <td><%= link_to 'Show', :action => 'show', :id => user %></td>
77 <td><%= link_to 'Show', :action => 'show', :id => user %></td>
77 <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
78 <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
78 <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
79 <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
79 </tr>
80 </tr>
80 <% end %>
81 <% end %>
81 </table>
82 </table>
82
83
83 <br />
84 <br />
84
85
85 <%= link_to '[New user]', :action => 'new' %>
86 <%= link_to '[New user]', :action => 'new' %>
86 <%= link_to '[New list of users]', :action => 'new_list' %>
87 <%= link_to '[New list of users]', :action => 'new_list' %>
@@ -1,50 +1,52
1 - content_for :header do
1 - content_for :header do
2 = javascript_include_tag 'new'
2 = javascript_include_tag 'new'
3
3
4 %script{:type=>"text/javascript"}
4 %script{:type=>"text/javascript"}
5 $(function () {
5 $(function () {
6 - $('#submission_table').tablesorter({widgets: ['zebra','filter']});
6 + $('#submission_table').tablesorter({widgets: ['zebra']});
7 });
7 });
8
8
9 :css
9 :css
10 .fix-width {
10 .fix-width {
11 font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
11 font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
12 }
12 }
13
13
14 %h1= @user.full_name + ' Profile'
14 %h1= @user.full_name + ' Profile'
15
15
16 %h2 Basic info
16 %h2 Basic info
17 <b>Login:</b> #{@user.login} <br/>
17 <b>Login:</b> #{@user.login} <br/>
18 <b>Full name:</b> #{@user.full_name} <br />
18 <b>Full name:</b> #{@user.full_name} <br />
19
19
20
20
21 %h2 Problem Stat
21 %h2 Problem Stat
22
22
23 %h2 Submissions
23 %h2 Submissions
24
24
25 %table.tablesorter-cafe#submission_table
25 %table.tablesorter-cafe#submission_table
26 %thead
26 %thead
27 %tr
27 %tr
28 %th ID
28 %th ID
29 %th Problem code
29 %th Problem code
30 - %th Problem name
30 + %th Problem full name
31 %th Language
31 %th Language
32 + %th Submitted at
32 %th Result
33 %th Result
33 %th Score
34 %th Score
34 - if session[:admin]
35 - if session[:admin]
35 %th IP
36 %th IP
36 %tbody
37 %tbody
37 - @submission.each do |s|
38 - @submission.each do |s|
38 - next unless s.problem
39 - next unless s.problem
39 %tr
40 %tr
40 %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id
41 %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id
41 %td= s.problem.name
42 %td= s.problem.name
42 %td= s.problem.full_name
43 %td= s.problem.full_name
43 %td= s.language.pretty_name
44 %td= s.language.pretty_name
45 + %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago)
44 %td.fix-width= s.grader_comment
46 %td.fix-width= s.grader_comment
45 %td= (s.points*100)/s.problem.full_score
47 %td= (s.points*100)/s.problem.full_score
46 - if session[:admin]
48 - if session[:admin]
47 %td= s.ip_address
49 %td= s.ip_address
48
50
49
51
50
52
You need to be logged in to leave comments. Login now