From 9e0a986fe92477d499531200825564b9f5f3c9af Mon Sep 17 00:00:00 2001 From: huang Date: Wed, 3 Jun 2015 16:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E3=80=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/mailer.rb | 9 ++++----- app/views/mailer/send_for_user_activities.html.erb | 7 +++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/mailer.rb b/app/models/mailer.rb index e0726599b..c13334b08 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -83,13 +83,10 @@ class Mailer < ActionMailer::Base # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 def send_for_user_activities(user, date_to, days) date_from = date_to - days.days - subject = "[ #{user.show_name}#{l(:label_day_mail)}]" @subject = " #{user.show_name}#{l(:label_day_mail)}" - date_from = "#{date_from} 17:59:59" date_to = "#{date_to} 17:59:59" - # 生成token用于直接点击登录 @user = user @token = Token.get_token_from_user(user, 'autologin') @@ -102,7 +99,7 @@ class Mailer < ActionMailer::Base # 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷 sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}' - and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" + and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc" @issues = Issue.find_by_sql(sql) # @bids 查询课程作业,包括老师发布的作业,以及user提交作业 @@ -125,7 +122,9 @@ 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在课程。项目中发布的讨论帖子 - 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") + messages = Message.find_by_sql("select me.* from messages me, boards b, members m where + b.id = me.board_id and b.project_id = m.project_id 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") @course_messages ||= [] @project_messages ||= [] unless messages.first.nil? diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 2cf070960..1ea977e89 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -193,6 +193,7 @@ <% end %> <% end %> + <% if @issues.first || @project_messages.first %>

<%= l(:label_project_overview_new)%>

@@ -260,11 +261,9 @@
<% end %> - - -
<% end %> + <% unless @user_journal_messages.first.nil? %>

<%= l(:label_activities) %>

@@ -293,7 +292,7 @@ <% end %>
- +
<% end %>