From b45e23d837a7e4e554239ae7583691aeacad5a36 Mon Sep 17 00:00:00 2001 From: z9hang Date: Sat, 8 Nov 2014 15:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=8C=BF=E8=AF=84=E4=BB=BD?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=80=BC=E6=98=BE=E7=A4=BA=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 2 ++ app/views/homework_attach/_show_star.html.erb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 6985cd900..2cf2e7895 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -392,6 +392,8 @@ class HomeworkAttachController < ApplicationController # percent_m.to_s + "%" #end #是否已经进行过评价 + 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 #是否开启互评功能 #@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil diff --git a/app/views/homework_attach/_show_star.html.erb b/app/views/homework_attach/_show_star.html.erb index 7cb49fed9..2044c5360 100644 --- a/app/views/homework_attach/_show_star.html.erb +++ b/app/views/homework_attach/_show_star.html.erb @@ -4,7 +4,7 @@ <% elsif is_comprehensive_evaluation == 2 %> <% if has_evaluation %> <%= l(:label_work_rating) %>: - <%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %> + <%= rating_for homework, dimension: :quality,start_score: @m_score, class: 'rateable div_inline' %> <% else %> <%= l(:label_work_rating) %>: <%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>