Description:
[web] uploading output-only submission
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@189 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
r100:2ce8f9387085 - - 2 files changed: 10 inserted, 2 deleted
@@ -59,13 +59,17 | |||
|
59 | 59 | redirect_to :action => 'list' |
|
60 | 60 | end |
|
61 | 61 | |
|
62 | 62 | def source |
|
63 | 63 | submission = Submission.find(params[:id]) |
|
64 | 64 | if submission.user_id == session[:user_id] |
|
65 | - fname = submission.problem.name + '.' + submission.language.ext | |
|
65 | + if submission.problem.output_only | |
|
66 | + fname = submission.source_filename | |
|
67 | + else | |
|
68 | + fname = submission.problem.name + '.' + submission.language.ext | |
|
69 | + end | |
|
66 | 70 | send_data(submission.source, |
|
67 | 71 | {:filename => fname, |
|
68 | 72 | :type => 'text/plain'}) |
|
69 | 73 | else |
|
70 | 74 | flash[:notice] = 'Error viewing source' |
|
71 | 75 | redirect_to :action => 'list' |
@@ -96,9 +96,13 | |||
|
96 | 96 | end |
|
97 | 97 | redirect_to :action => 'list' |
|
98 | 98 | end |
|
99 | 99 | |
|
100 | 100 | def stat |
|
101 | 101 | @problem = Problem.find(params[:id]) |
|
102 | - @submissions = Submission.find_all_last_by_problem(params[:id]) | |
|
102 | + if !@problem.available | |
|
103 | + redirect_to :controller => 'main', :action => 'list' | |
|
104 | + else | |
|
105 | + @submissions = Submission.find_all_last_by_problem(params[:id]) | |
|
106 | + end | |
|
103 | 107 | end |
|
104 | 108 | end |
You need to be logged in to leave comments.
Login now