From 0970182cd5c497dd477782f1d150a769fb70fde5 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Mon, 27 Apr 2015 17:25:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E6=95=99=E5=B8=88=E5=8F=AA=E8=AF=84?= =?UTF-8?q?=E5=88=86=E4=B8=8D=E8=AF=84=E8=AE=BA=E6=97=B6=EF=BC=8C=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=8F=AF=E4=BB=A5=E8=BF=9B=E8=A1=8C=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E4=BD=9C=E4=B8=9A=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=A1=86=E6=A0=B7=E5=BC=8F=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=EF=BC=8C=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=8F=8D=E9=A6=88=E6=A1=86=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 6 ++++-- app/models/journals_for_message.rb | 6 +++++- app/views/words/_journal_reply_items.html.erb | 2 +- app/views/words/_new_respond.html.erb | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ee95277ce..811b19ad6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -473,8 +473,10 @@ class HomeworkAttachController < ApplicationController #保存评论 @is_comprehensive_evaluation = @is_teacher ? 1 : (@is_anonymous_comments ? 2 : 3) #判断当前评论是老师评论?匿评?留言 - if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" #有没有留言 - @homework.addjours User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation + if params[:new_form] && params[:new_form][:user_message] #有没有留言 + @homework.addjours(User.current.id, params[:new_form][:user_message],0,@is_comprehensive_evaluation) if @is_teacher + else + @homework.addjours User.current.id, "",0,@is_comprehensive_evaluation if @is_teacher end @teacher_stars = @stars_reates.where("is_teacher_score = 1") #老师评分列表 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 396501862..0a6944e3b 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,7 +56,7 @@ class JournalsForMessage < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - validates :notes, presence: true + validates :notes, presence: true, if: :is_homework_jour? after_create :act_as_activity #huang after_create :reset_counters! after_destroy :reset_counters! @@ -88,6 +88,10 @@ class JournalsForMessage < ActiveRecord::Base self.find(message_id).destroy # self.destroy_all "id = #{message_id}" end + + def is_homework_jour? + self.jour_type != "HomeworkAttach" + end def reference_user User.find(reply_id) diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index 716a27ffe..d52f7cfe1 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -40,7 +40,7 @@