1.增加issue截止日期提醒消息;

2.修改相应rake代码
This commit is contained in:
ouyangxuhua 2015-09-29 10:15:35 +08:00
parent da5e137795
commit 769a4a1bcf
2 changed files with 48 additions and 24 deletions

View File

@ -56,6 +56,31 @@
</ul>
<% end %>
<% if ma.forge_message_type == "Issue" %>
<% if ma.status == 1%>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>"><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%></span>
</li>
<li class="homepageHomeworkContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, issue_path(:id => ma.forge_message.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">
<p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.description.nil? || ma.forge_message.description == "" %>
<div class="fl"><strong>描述:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 截止时间快到了!</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% else %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a>
@ -79,6 +104,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<% if ma.forge_message_type == "Journal" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">

View File

@ -4,14 +4,12 @@ namespace :issue_due_date do
task :end_time => :environment do
contrast_time = Time.now - 86400
issues = Issue.where("due_date >=? and due_date <=?",contrast_time,Time.now)
puts issues
issues.each do |issue|
if ForgeMessage.where("forge_message_type =? and forge_message_id =? and status =?", "Issue", issue.id, 1).first.nil?
recipients = []
assigner = User.find(issue.assigned_to_id)
recipients << issue.author
recipients << assigner
puts recipients
recipients.each do |r|
issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1)
# 发送邮件通知