From f5b1cbcfe456ee36e823e0745180ca6f21b70a21 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 1 Dec 2014 14:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BD=9C=E4=B8=9A=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E6=A1=86=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 14 +++++++++----- app/views/homework_attach/_addjour.html.erb | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index dacf897da..2f6be7611 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -372,11 +372,11 @@ class HomeworkAttachController < ApplicationController def show if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first) # 打分统计 - stars_reates = @homework. rates(:quality) + #stars_reates = @homework. rates(:quality) #是否已经进行过评价 temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first @m_score = temp.nil? ? 0:temp.stars - @has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0 + @has_evaluation = @homework.has_rated?( User.current,:quality) #@jours留言 is null条件用以兼容历史数据 @jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC") @cur_page = params[:cur_page] || 1 @@ -385,13 +385,17 @@ class HomeworkAttachController < ApplicationController teachers = searchTeacherAndAssistant @course @comprehensive_evaluation = [] + #JourForMessage的is_comprehensive_evaluation字段: + #1:老师评价 + #2:学生评价 + #3 || null:学生留言 teachers.each do|teacher| temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first @comprehensive_evaluation << temp if temp end - annymous_users = @homework.homework_evaluations.map(&:user) - unless annymous_users.nil? || annymous_users.count == 0 - @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC") + annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',') + unless annymous_users.nil? || annymous_users == "" + @anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC") end #@totle_score = score_for_homework @homework #@teaher_score = teacher_score_for_homework @homework diff --git a/app/views/homework_attach/_addjour.html.erb b/app/views/homework_attach/_addjour.html.erb index 5b2889b57..8d4c1eaf2 100644 --- a/app/views/homework_attach/_addjour.html.erb +++ b/app/views/homework_attach/_addjour.html.erb @@ -50,7 +50,7 @@ } } - function submit1(button) + function submit1() { $('#jours_submit').parent().submit(); }