修改issues邮件通知查询语句

This commit is contained in:
huang 2015-06-03 14:25:22 +08:00
parent 64e56eca8e
commit 0354e65497
1 changed files with 68 additions and 70 deletions

View File

@ -45,6 +45,7 @@ class Mailer < ActionMailer::Base
MailerProxy.new(self) MailerProxy.new(self)
end end
# author: alan
# 发送邀请未注册用户加入项目邮件 # 发送邀请未注册用户加入项目邮件
# 功能: 在加入项目的同时自动注册用户 # 功能: 在加入项目的同时自动注册用户
def send_invite_in_project(email, project, invitor) def send_invite_in_project(email, project, invitor)
@ -100,16 +101,14 @@ class Mailer < ActionMailer::Base
course_ids = courses.map {|course| course.id}.join(",") course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷包括发布的跟踪的以及被指派的缺陷 # 查询user的缺陷包括发布的跟踪的以及被指派的缺陷
# sql = "select DISTINCT i.* from issues i, watchers w sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
# where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id} and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
# or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
# and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
sql = "select DISTINCT i.* from issues i where (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql) @issues = Issue.find_by_sql(sql)
# @bids 查询课程作业包括老师发布的作业以及user提交作业 # @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新 # @attachments查询课程课件更新
@attachments ||= [] @attachments ||= []
@bids ||= [] # 老师发布的作业 @bids ||= [] # 老师发布的作业
unless courses.first.nil? unless courses.first.nil?
@ -126,7 +125,7 @@ class Mailer < ActionMailer::Base
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子 # 查询user在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select DISTINCT * from messages where (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= [] @course_messages ||= []
@project_messages ||= [] @project_messages ||= []
unless messages.first.nil? unless messages.first.nil?
@ -187,8 +186,8 @@ class Mailer < ActionMailer::Base
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]", :subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
:filter => true :filter => true
end end
# Builds a Mail::Message object used to email recipients of the added journals for message. # Builds a Mail::Message object used to email recipients of the added journals for message.
# 留言分为直接留言,和对留言人留言的回复 # 留言分为直接留言,和对留言人留言的回复
# 字段说明在JournalsForMessage.rb # 字段说明在JournalsForMessage.rb
# 直接留言后 reply_id,m_parent_id 为空相对应的at_user取值为nil # 直接留言后 reply_id,m_parent_id 为空相对应的at_user取值为nil
@ -510,7 +509,7 @@ class Mailer < ActionMailer::Base
end end
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added. # Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
# 新增新闻评论时邮件通知 #
# Example: # Example:
# news_comment_added(comment) => Mail::Message object # news_comment_added(comment) => Mail::Message object
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients # Mailer.news_comment_added(comment) => sends an email to the news' project recipients
@ -911,7 +910,6 @@ class Mailer < ActionMailer::Base
:file => attachment.decoded, :file => attachment.decoded,
:filename => attachment.filename, :filename => attachment.filename,
:author => user, :author => user,
:content_type => attachment.mime_type) :content_type => attachment.mime_type)
end end
end end