Description:
fixed submission view bug, reported by chalet
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@292 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
r153:15e1ee6d602b - - 1 file changed: 5 inserted, 0 deleted
@@ -114,24 +114,29 | |||||
|
114 | redirect_to :action => 'list' |
|
114 | redirect_to :action => 'list' |
|
115 | end |
|
115 | end |
|
116 | end |
|
116 | end |
|
117 |
|
117 | ||
|
118 | def submission |
|
118 | def submission |
|
119 | @user = User.find(session[:user_id]) |
|
119 | @user = User.find(session[:user_id]) |
|
120 | @problems = Problem.find_available_problems |
|
120 | @problems = Problem.find_available_problems |
|
121 | if params[:id]==nil |
|
121 | if params[:id]==nil |
|
122 | @problem = nil |
|
122 | @problem = nil |
|
123 | @submissions = nil |
|
123 | @submissions = nil |
|
124 | else |
|
124 | else |
|
125 | @problem = Problem.find_by_name(params[:id]) |
|
125 | @problem = Problem.find_by_name(params[:id]) |
|
|
126 | + if not @problem.available | ||
|
|
127 | + redirect_to :action => 'list' | ||
|
|
128 | + flash[:notice] = 'Error: submissions for that problem is not available' | ||
|
|
129 | + return | ||
|
|
130 | + end | ||
|
126 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
131 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
127 | end |
|
132 | end |
|
128 | end |
|
133 | end |
|
129 |
|
134 | ||
|
130 | def result |
|
135 | def result |
|
131 | if !Configuration.show_grading_result |
|
136 | if !Configuration.show_grading_result |
|
132 | redirect_to :action => 'list' and return |
|
137 | redirect_to :action => 'list' and return |
|
133 | end |
|
138 | end |
|
134 | @user = User.find(session[:user_id]) |
|
139 | @user = User.find(session[:user_id]) |
|
135 | @submission = Submission.find(params[:id]) |
|
140 | @submission = Submission.find(params[:id]) |
|
136 | if @submission.user!=@user |
|
141 | if @submission.user!=@user |
|
137 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
142 | flash[:notice] = 'You are not allowed to view result of other users.' |
You need to be logged in to leave comments.
Login now