diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb
--- a/app/controllers/main_controller.rb
+++ b/app/controllers/main_controller.rb
@@ -52,6 +52,18 @@
end
end
+ def submission
+ @user = User.find(session[:user_id])
+ @problems = Problem.find_available_problems
+ if params[:id]==nil
+ @problem = nil
+ @submissions = nil
+ else
+ @problem = Problem.find_by_name(params[:id])
+ @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id)
+ end
+ end
+
protected
def prepare_list_information
@problems = Problem.find_available_problems
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -7,6 +7,7 @@
# main page
append_to menu_items, '[Main]', 'main', 'list'
+ append_to menu_items, '[Submissions]', 'main', 'submission'
append_to menu_items, '[Test]', 'test', 'index'
# admin menu
diff --git a/app/models/submission.rb b/app/models/submission.rb
--- a/app/models/submission.rb
+++ b/app/models/submission.rb
@@ -49,6 +49,14 @@
})
end
+ def self.find_all_by_user_problem(user_id, problem_id)
+ Submission.find(:all,
+ :conditions => {
+ :user_id => user_id,
+ :problem_id => problem_id,
+ })
+ end
+
protected
def self.find_option_in_source(option, source)
diff --git a/app/views/main/_compiler_message.html.erb b/app/views/main/_compiler_message.html.erb
--- a/app/views/main/_compiler_message.html.erb
+++ b/app/views/main/_compiler_message.html.erb
@@ -1,10 +1,15 @@
-
-
-
- <%=h(compiler_message).gsub(/\n/,'
') %>
+ (click to see)
-
+
+
+ <%=h(compiler_message).gsub(/\n/,'
') %>
+
+
+<% end %>
diff --git a/app/views/main/_problem.html.erb b/app/views/main/_problem.html.erb
--- a/app/views/main/_problem.html.erb
+++ b/app/views/main/_problem.html.erb
@@ -10,7 +10,7 @@
<%= @prob_submissions[problem_counter][:count] %>
- <%= render :partial => 'submission',
+ <%= render :partial => 'submission_short',
:locals => { :submission => @prob_submissions[problem_counter][:submission]} %>
|
diff --git a/app/views/main/_submission.html.haml b/app/views/main/_submission.html.haml
--- a/app/views/main/_submission.html.haml
+++ b/app/views/main/_submission.html.haml
@@ -1,13 +1,14 @@
-- if submission==nil
- = "-"
-- else
- - if submission.graded_at==nil
- Submitted at
- = format_short_time(submission.submitted_at)
- - else
- = "Graded at #{format_short_time(submission.graded_at)}, "
- = "score: #{submission.points} "
- = " [" + submission.grader_comment + "]"
- = " | "
- = link_to('[source]',{:action => 'get_source', :id => submission.id})
+%tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
+ %td.info{:align => "center"}
+ = submission_counter+1
+ %td.info= format_short_time(submission.submitted_at)
+ %td.info= link_to('[source]',{:action => 'get_source', :id => submission.id})
+ %td.info
+ - if submission.graded_at!=nil
+ = "Graded at #{format_short_time(submission.graded_at)}."
+ %br/
+ = "Score: #{submission.points} "
+ = " [" + submission.grader_comment + "]"
+ %td.info
+ = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message }
diff --git a/app/views/main/_submission_short.html.haml b/app/views/main/_submission_short.html.haml
new file mode 100644
--- /dev/null
+++ b/app/views/main/_submission_short.html.haml
@@ -0,0 +1,13 @@
+
+- if submission==nil
+ = "-"
+- else
+ - if submission.graded_at==nil
+ Submitted at
+ = format_short_time(submission.submitted_at)
+ - else
+ = "Graded at #{format_short_time(submission.graded_at)}, "
+ = "score: #{submission.points} "
+ = " [" + submission.grader_comment + "]"
+ = " | "
+ = link_to('[source]',{:action => 'get_source', :id => submission.id})
diff --git a/app/views/main/submission.html.haml b/app/views/main/submission.html.haml
new file mode 100644
--- /dev/null
+++ b/app/views/main/submission.html.haml
@@ -0,0 +1,24 @@
+.title
+ Hello
+ =h @user.full_name
+
+Current time is
+= format_short_time(Time.new)
+%br/
+
+.task-menu
+ Tasks:
+ - @problems.each do |problem|
+ = link_to problem.name, :action => 'submission', :id => problem.name
+
+- if @submissions!=nil
+ %table.info
+ %tr.info-head
+ %th.info Sub #
+ %th.info Time
+ %th.info Source
+ %th.info Results
+ %th.info{:width => "300px"}
+ Compiler message
+ = render :partial => 'submission', :collection => @submissions
+
diff --git a/app/views/test/_test_request.html.haml b/app/views/test/_test_request.html.haml
--- a/app/views/test/_test_request.html.haml
+++ b/app/views/test/_test_request.html.haml
@@ -1,11 +1,11 @@
-%tr.test-request
- %td= test_request_counter +1
- %td= test_request.problem.full_name
- %td= test_request.submission.number
- %td= test_request.status_str
- %td= test_request.running_stat or ''
- %td
+%tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"}
+ %td.info= test_request_counter +1
+ %td.info= test_request.problem.full_name
+ %td.info= test_request.submission.number
+ %td.info= test_request.status_str
+ %td.info= test_request.running_stat or ''
+ %td.info
- if test_request.output_file_name!=nil
= link_to '[output]', :action => 'read', :id => test_request.id
- %td= test_request.grader_comment or ''
- %td= test_request.compiler_message or ''
+ %td.info= test_request.grader_comment or ''
+ %td.info= test_request.compiler_message or ''
diff --git a/app/views/test/index.html.erb b/app/views/test/index.html.erb
--- a/app/views/test/index.html.erb
+++ b/app/views/test/index.html.erb
@@ -39,7 +39,7 @@
<%= select(:test_request,
:submission_number,
- (1..@submissions[0].number).collect {|n| [n,n]}) %>
+ ((1..@submissions[0].number).collect {|n| [n,n]}).reverse) %>
|
@@ -55,18 +55,18 @@
Previous requests
-
-
-
- | problem |
- # |
- status |
- running stat |
- output (first 2kb) |
- grading comment |
- compiler message |
+
+
+
+ | problem |
+ # |
+ status |
+ running stat |
+ output (first 2kb) |
+ grading comment |
+ compiler message |
-<%= render :partial => 'test_request', :collection => @user.test_requests %>
+ <%= render :partial => 'test_request', :collection => @user.test_requests %>
<% end %>
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -9,11 +9,6 @@
padding: 2px;
}
-div.problist-each {
- margin-top: 2px;
- margin-bottom: 2px
-}
-
div.userbar {
border-top: thin solid grey;
border-bottom: thin solid grey;
@@ -21,21 +16,6 @@
font-size: 12px;
}
-div.probname {
- background-color: #eeeeee;
- font-weight: bold;
- padding: 2px;
- border: 1px solid black;
-}
-
-div.subinfo {
- margin-left: 20px;
- margin-top: 2px;
- border-bottom: thin solid grey;
- border-left: thin solid grey;
- font-size: 12px;
-}
-
div.compilermsgbody {
font-family: monospace;
}
@@ -46,16 +26,15 @@
color: white;
background-color: #777777;
font-weight: bold;
+ font-size: 13px;
}
-
table.uinfo {
border-collapse: collapse;
border: 1px solid black;
font-size: 13px;
}
-
td.uinfo {
vertical-align: top;
border: 1px solid black;
@@ -92,3 +71,13 @@
tr.info-even {
background: #eeeeee;
}
+
+div.task-menu {
+ text-align: center;
+ font-size: 13px;
+ font-weight: bold;
+ border-top: 1px solid black;
+ border-bottom: 1px solid black;
+ margin-top: 2px;
+ margin-bottom: 4px;
+}