Description:
fix bug: test_request: read empty output file git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@102 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r49:5bcf18c63ae4 - - 1 file changed: 3 inserted, 0 deleted

@@ -22,24 +22,27
22 22 end
23 23
24 24 def read
25 25 user = User.find(session[:user_id])
26 26 test_request = TestRequest.find(params[:id])
27 27 if test_request.user_id != user.id
28 28 flash[:notice] = 'Invalid output'
29 29 redirect_to :action => 'index'
30 30 return
31 31 end
32 32 if test_request.output_file_name!=nil
33 33 data = File.open(test_request.output_file_name).read(2048)
34 + if data==nil
35 + data=""
36 + end
34 37 send_data(data,
35 38 {:filename => 'output.txt',
36 39 :type => 'text/plain'})
37 40 return
38 41 end
39 42 redirect_to :action => 'index'
40 43 end
41 44
42 45 protected
43 46
44 47 def prepare_index_information
45 48 @submissions = Submission.find_last_for_all_available_problems(@user.id)
You need to be logged in to leave comments. Login now