diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 30fd0ff50..3dd5e9890 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -2,7 +2,7 @@ class StudentWorkController < ApplicationController layout "base_courses" include StudentWorkHelper require 'bigdecimal' - before_filter :find_homework, :only => [:new, :index, :create] + before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] @@ -233,6 +233,15 @@ class StudentWorkController < ApplicationController end end + #评价列表显示 + def student_work_absence_penalty + render_403 unless User.current.allowed_to?(:as_teacher,@course) + @stundet_works = @homework.student_works + respond_to do |format| + format.html + end + end + private #获取作业 def find_homework diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 990a563c4..7c85dc5c4 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -60,4 +60,14 @@ module StudentWorkHelper def is_praise_homework user_id, obj_id PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty? end + + #获取指定学生在指定作业内应匿评的数量 + def all_evaluation_count user,homework + StudentWorksEvaluationDistribution.joins(:student_work).where("student_works_evaluation_distributions.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count + end + + #获取指定学生在指定作业内已匿评的数量 + def has_evaluation_count user,homework + StudentWorksScore.joins(:student_work).where("student_works_scores.user_id = #{user.id} AND student_works.homework_common_id = #{homework.id}").count + end end \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index c9e8cd4c6..09d1c8f60 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -18,7 +18,6 @@ 返


-