diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 710811960..abf7e24d1 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -108,7 +108,13 @@ class StudentWorkController < ApplicationController end def destroy - + if @work.destroy + respond_to do |format| + format.html { + redirect_to student_work_index_url(:homework => @homework.id) + } + end + end end #添加评分,已评分则为修改评分 @@ -226,9 +232,9 @@ class StudentWorkController < ApplicationController end #判断是不是当前作品的提交者 - #提交者可以编辑作品 + #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - # render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless User.current.id == @work.user_id && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end #根据条件过滤作业结果 diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index de14c0cb1..b9ebf3269 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -8,7 +8,7 @@ <% if @work.user == User.current %>