From 43363e8bcb89021e5e7ad5eaa2de8e596d3c3813 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 18 Jun 2015 17:56:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E8=AF=84=E6=83=85=E5=86=B5=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 11 +++- app/helpers/student_work_helper.rb | 10 ++++ app/views/student_work/index.html.erb | 2 +- .../student_work_absence_penalty.html.erb | 54 +++++++++++++++++++ config/routes.rb | 1 + public/stylesheets/courses.css | 6 ++- public/stylesheets/public.css | 1 + 7 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 app/views/student_work/student_work_absence_penalty.html.erb 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 @@ 返


-