diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 204aa109a..7411dd30f 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -127,12 +127,12 @@ class Mailer < ActionMailer::Base # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") # 查询user在课程中发布的讨论帖子 - course_mesages = Message.find_by_sql("select 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 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") # 查询user在项目中发布的讨论帖子 - project_messages = Message.find_by_sql("select 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 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") # 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") diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 9723783fe..54d2db43c 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -108,7 +108,7 @@