项目中邮件通知按项目排序
This commit is contained in:
parent
f8a35d2f97
commit
b5badbd25f
|
@ -110,7 +110,7 @@ class Mailer < ActionMailer::Base
|
|||
# issue回复
|
||||
@issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
|
||||
where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id
|
||||
and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc")
|
||||
|
||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# @attachments查询课程课件更新
|
||||
|
@ -130,7 +130,7 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 项目附件
|
||||
@project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
|
||||
where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc")
|
||||
where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, a.created_on desc")
|
||||
|
||||
# user 提交的作业
|
||||
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
|
@ -138,7 +138,7 @@ class Mailer < ActionMailer::Base
|
|||
# 查询user所在项目添加wiki
|
||||
@wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
||||
m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
|
||||
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc")
|
||||
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
|
||||
|
||||
# 查询user在课程中发布的讨论帖子
|
||||
course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
|
@ -149,7 +149,7 @@ class Mailer < ActionMailer::Base
|
|||
# 查询user在项目中发布的讨论帖子
|
||||
project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
b.id = me.board_id and b.project_id = m.project_id
|
||||
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, 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 ||= []
|
||||
@project_messages ||= []
|
||||
|
@ -176,7 +176,7 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 查询user在项目中添加新闻和回复新闻
|
||||
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : []
|
||||
|
||||
@project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
|
||||
where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id
|
||||
|
|
Loading…
Reference in New Issue