作业回复的消息通知,评阅作品的消息通知修改

This commit is contained in:
cxt 2016-05-12 14:13:34 +08:00
parent 7761bd5313
commit ca5f03f2ea
3 changed files with 39 additions and 2 deletions

View File

@ -256,6 +256,11 @@ class JournalsForMessage < ActiveRecord::Base
end end
end end
if self.jour_type == 'HomeworkCommon' 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 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 if count == 0
ws = WechatService.new ws = WechatService.new

View File

@ -18,17 +18,29 @@ class StudentWorksScore < ActiveRecord::Base
receiver = self.student_work.user receiver = self.student_work.user
# 判断是第一次评阅还是更新 status:0 新建1 更新 # 判断是第一次评阅还是更新 status:0 新建1 更新
if self.created_at == self.updated_at 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, 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) :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 else
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> false) :viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> false)
end end
else # 更新 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, 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) :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 else
self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id,
:viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> true) :viewed => false, :content => "作业评分:#{self.score}&nbsp;&nbsp;&nbsp; 评语:#{self.comment}", :status=> true)

View File

@ -409,6 +409,26 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li> <li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul> </ul>
<% end %> <% 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 %> <% else %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"> <li class="homepageNewsPortrait fl">