|
|
@ -125,11 +125,17 @@ class Mailer < ActionMailer::Base
|
|
|
|
# user 提交的作业
|
|
|
|
# user 提交的作业
|
|
|
|
# @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所在项目添加wiki
|
|
|
|
|
|
|
|
@wiki_contents = WikiContent.find_by_sql("SELECT wc.* FROM wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
|
|
|
|
|
|
|
m.user_id = '#{user.id}' and p.user_id = m.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")
|
|
|
|
|
|
|
|
|
|
|
|
# 查询user在课程中发布的讨论帖子
|
|
|
|
# 查询user在课程中发布的讨论帖子
|
|
|
|
course_mesages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where
|
|
|
|
course_mesages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where
|
|
|
|
b.id = me.board_id and b.course_id = m.course_id
|
|
|
|
b.id = me.board_id and b.course_id = m.course_id
|
|
|
|
and b.course_id is not Null and m.user_id = '#{user.id}'
|
|
|
|
and b.course_id is not Null and m.user_id = '#{user.id}'
|
|
|
|
and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
|
|
|
and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
|
|
|
|
|
|
|
|
|
|
|
# 查询user在项目中发布的讨论帖子
|
|
|
|
# 查询user在项目中发布的讨论帖子
|
|
|
|
project_messages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where
|
|
|
|
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
|
|
|
|
b.id = me.board_id and b.project_id = m.project_id
|
|
|
@ -167,7 +173,7 @@ class Mailer < ActionMailer::Base
|
|
|
|
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
|
|
|
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
|
|
|
|
|
|
|
|
|
|
|
has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
|
|
|
|
has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
|
|
|
|
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
|
|
|
|
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
|
|
|
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
|
|
|
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
|
|
|
#有内容才发,没有不发
|
|
|
|
#有内容才发,没有不发
|
|
|
|
mail :to => user.mail,:subject => subject if has_content
|
|
|
|
mail :to => user.mail,:subject => subject if has_content
|
|
|
|