Description:
[web] improving readability of test_interface, re: ticket #10
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@141 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r64:f6cdb5f921b2 - - 5 files changed: 6 inserted, 5 deleted
@@ -5,12 +5,13 | |||||
|
5 | verify :method => :post, :only => [:test_submit], |
|
5 | verify :method => :post, :only => [:test_submit], |
|
6 | :redirect_to => { :action => :index } |
|
6 | :redirect_to => { :action => :index } |
|
7 |
|
7 | ||
|
8 | def index |
|
8 | def index |
|
9 | @user = User.find(session[:user_id]) |
|
9 | @user = User.find(session[:user_id]) |
|
10 | prepare_index_information |
|
10 | prepare_index_information |
|
|
11 | + @test_requests = @user.test_requests | ||
|
11 | end |
|
12 | end |
|
12 |
|
13 | ||
|
13 | def submit |
|
14 | def submit |
|
14 | @user = User.find(session[:user_id]) |
|
15 | @user = User.find(session[:user_id]) |
|
15 | test_request = TestRequest.new_from_form_params(@user,params[:test_request]) |
|
16 | test_request = TestRequest.new_from_form_params(@user,params[:test_request]) |
|
16 | if test_request.save |
|
17 | if test_request.save |
@@ -1,13 +1,13 | |||||
|
1 | require 'digest/sha1' |
|
1 | require 'digest/sha1' |
|
2 |
|
2 | ||
|
3 | class User < ActiveRecord::Base |
|
3 | class User < ActiveRecord::Base |
|
4 |
|
4 | ||
|
5 | has_and_belongs_to_many :roles |
|
5 | has_and_belongs_to_many :roles |
|
6 |
|
6 | ||
|
7 |
- has_many :test_requests, :order => " |
|
7 | + has_many :test_requests, :order => "submitted_at DESC" |
|
8 |
|
8 | ||
|
9 | validates_presence_of :login |
|
9 | validates_presence_of :login |
|
10 | validates_presence_of :full_name |
|
10 | validates_presence_of :full_name |
|
11 | validates_length_of :full_name, :minimum => 1 |
|
11 | validates_length_of :full_name, :minimum => 1 |
|
12 |
|
12 | ||
|
13 | validates_presence_of :password, :if => :password_required? |
|
13 | validates_presence_of :password, :if => :password_required? |
@@ -1,11 +1,11 | |||||
|
1 | %tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"} |
|
1 | %tr{:class => (test_request_counter%2==0) ? "info-even" : "info-odd"} |
|
2 | %td= test_request_counter +1 |
|
2 | %td= test_request_counter +1 |
|
3 | %td= test_request.problem.full_name |
|
3 | %td= test_request.problem.full_name |
|
4 | %td= test_request.submission.number |
|
4 | %td= test_request.submission.number |
|
5 | %td= test_request.status_str |
|
5 | %td= test_request.status_str |
|
6 | - %td= test_request.running_stat or '' |
|
6 | + %td= simple_format((test_request.running_stat or '')) |
|
7 | %td |
|
7 | %td |
|
8 | - if test_request.output_file_name!=nil |
|
8 | - if test_request.output_file_name!=nil |
|
9 | = link_to '[output]', :action => 'read', :id => test_request.id |
|
9 | = link_to '[output]', :action => 'read', :id => test_request.id |
|
10 | %td= test_request.grader_comment or '' |
|
10 | %td= test_request.grader_comment or '' |
|
11 | - %td= test_request.compiler_message or '' |
|
11 | + %td= simple_format((test_request.compiler_message or '')) |
@@ -63,11 +63,11 | |||||
|
63 | <th>status</th> |
|
63 | <th>status</th> |
|
64 | <th>running stat</th> |
|
64 | <th>running stat</th> |
|
65 | <th>output (first 2kb)</th> |
|
65 | <th>output (first 2kb)</th> |
|
66 | <th>grading comment</th> |
|
66 | <th>grading comment</th> |
|
67 | <th>compiler message</th> |
|
67 | <th>compiler message</th> |
|
68 | </tr> |
|
68 | </tr> |
|
69 |
- <%= render :partial => 'test_request', :collection => @ |
|
69 | + <%= render :partial => 'test_request', :collection => @test_requests %> |
|
70 | </table> |
|
70 | </table> |
|
71 |
|
71 | ||
|
72 | <% end %> |
|
72 | <% end %> |
|
73 |
|
73 |
@@ -1,10 +1,10 | |||||
|
1 |
|
1 | ||
|
2 | require File.dirname(__FILE__) + '/../spec_helper' |
|
2 | require File.dirname(__FILE__) + '/../spec_helper' |
|
3 |
|
3 | ||
|
4 | - describe Submission do |
|
4 | + describe Submission, "when verifying user submission" do |
|
5 |
|
5 | ||
|
6 | before(:each) do |
|
6 | before(:each) do |
|
7 | @submission = Submission.new |
|
7 | @submission = Submission.new |
|
8 | @submission.source = <<SOURCE |
|
8 | @submission.source = <<SOURCE |
|
9 | /* |
|
9 | /* |
|
10 | LANG: C++ |
|
10 | LANG: C++ |
You need to be logged in to leave comments.
Login now