From d4b3afb54e0830cfe89fd235bef3e46fcfbe9210 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Fri, 29 May 2015 14:06:16 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E3=80=81=E6=88=91=E7=9A=84=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8F=96=E6=B6=88=E6=8E=92=E5=BA=8F=202?= =?UTF-8?q?=E3=80=81=E6=89=93=E5=88=86=E7=9A=84=E6=9D=83=E9=99=90=E8=AE=BE?= =?UTF-8?q?=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 8 ++++++-- app/views/student_work/index.html.erb | 18 +++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 49e54a273..2cef3f40c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -11,7 +11,8 @@ class StudentWorkController < ApplicationController @order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || "" @is_teacher = User.current.allowed_to?(:as_teacher,@course) #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 + @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 + if @show_all @stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name else #学生 if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 @@ -120,8 +121,11 @@ class StudentWorkController < ApplicationController #添加评分,已评分则为修改评分 def add_score - @score = student_work_score @work,User.current + render_403 and return if User.current == @work.user #不可以匿评自己的作品 @is_teacher = User.current.allowed_to?(:as_teacher,@course) + #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 + render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2) + @score = student_work_score @work,User.current if @score @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @score.score = params[:score] if params[:score] diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 27dee3f91..a0612fd53 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -34,7 +34,7 @@ <%= link_to "所有作品(#{@stundet_works.count})".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%> - <% if @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3%> + <% if @show_all%> <% end%> <% if @is_teacher%> @@ -63,26 +63,26 @@ 作品名称
  • - <%= link_to "教师评分",student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%> - <% if @order == "teacher_score"%> + <%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> + <% if @show_all && @order == "teacher_score"%> <% end%>
  • - <%= link_to "教辅评分",student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%> - <% if @order == "teaching_asistant_score"%> + <%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> + <% if @show_all && @order == "teaching_asistant_score"%> <% end%>
  • - <%= link_to "匿评",student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%> - <% if @order == "student_score"%> + <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> + <% if @show_all && @order == "student_score"%> <% end%>
  • - <%= link_to "成绩",student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name),:class => "c_dark f14 fb fl"%> - <% if @order == "final_score"%> + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "c_dark f14 fb fl"%> + <% if @show_all && @order == "final_score"%> <% end%>