作业回复的消息通知,评阅作品的消息通知修改
This commit is contained in:
parent
7761bd5313
commit
ca5f03f2ea
|
@ -256,6 +256,11 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
if self.jour_type == 'HomeworkCommon'
|
||||
if self.m_parent_id.nil?
|
||||
if self.user_id != self.jour.user_id
|
||||
self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false)
|
||||
end
|
||||
end
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count
|
||||
if count == 0
|
||||
ws = WechatService.new
|
||||
|
|
|
@ -18,17 +18,29 @@ class StudentWorksScore < ActiveRecord::Base
|
|||
receiver = self.student_work.user
|
||||
# 判断是第一次评阅还是更新 status:0 新建;1 更新
|
||||
if self.created_at == self.updated_at
|
||||
if self.comment.nil?
|
||||
if self.comment.nil? && self.score
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score}", :status=> false)
|
||||
elsif self.score.nil? && self.comment
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "评语:#{self.comment}", :status=> false)
|
||||
elsif self.comment.nil? && self.score.nil?
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "上传了批阅附件", :status=> false)
|
||||
else
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score} 评语:#{self.comment}", :status=> false)
|
||||
end
|
||||
else # 更新
|
||||
if self.comment.nil?
|
||||
if self.comment.nil? && self.score
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score}", :status=> true)
|
||||
elsif self.score.nil? && self.comment
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "评语:#{self.comment}", :status=> true)
|
||||
elsif self.comment.nil? && self.score.nil?
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "上传了批阅附件", :status=> true)
|
||||
else
|
||||
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
|
||||
:viewed => false, :content => "作业评分:#{self.score} 评语:#{self.comment}", :status=> true)
|
||||
|
|
|
@ -409,6 +409,26 @@
|
|||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% elsif ma.course_message.jour_type == 'HomeworkCommon' %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl"><%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">回复了您的作业:</span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
|
||||
<%= link_to ma.course_message.notes.html_safe, homework_common_index_url_in_org( ma.course_id),
|
||||
:class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
|
||||
<!--:onmouseover => "message_titile_show($(this),event)",-->
|
||||
<!--:onmouseout => "message_titile_hide($(this))" %>-->
|
||||
</a>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<%= ma.course_message.notes.html_safe %>
|
||||
</div>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% else %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
|
|
Loading…
Reference in New Issue