diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 087fb6d73..1325ef613 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -115,14 +115,15 @@ class Mailer < ActionMailer::Base
count = courses.count
count = count - 1
for i in 0..count do
- bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
+ bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0
+
end
end
# 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在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
@@ -157,7 +158,7 @@ class Mailer < ActionMailer::Base
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
- has_content = [@issues,@homeworks,@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?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index da8b4c8c3..e1712a15d 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -3,7 +3,7 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
- @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
+ @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
@@ -39,7 +39,7 @@
<% end %>
- <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+ <% if !@bids.first.nil? %>
<%= l(:label_homework_overview) %>(<%= @bids.count %>)
<% unless @bids.first.nil?%>
@@ -65,29 +65,6 @@
<% end %>
<% end %>
- <% unless @homeworks.first.nil? %>
- <% @homeworks.each do |homework| %>
- -
- ▪
- [
-
- <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
- :class=> "wmail_column",
- :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
- ]
-
- <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
- :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
- <%= l(:label_course_submit_homework) %>
-
- <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
- :class => 'wmail_info',
- :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
- %>
- <%= format_time(homework.created_at) %>
-
- <% end %>
- <% end %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index 59735225d..2a2382301 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -1,6 +1,6 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
- @homeworks.first || @course_journal_messages.first|| @course_messages.first %>
+ @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
<%= l(:label_course_news) %>
@@ -27,7 +27,7 @@
<% end %>
<% end %>
- <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+ <% if !@bids.first.nil? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
@@ -51,26 +51,6 @@
<% end %>
<% end %>
- <% unless @homeworks.first.nil? %>
- <% @homeworks.each do |homework| %>
- ▪[
-
- <%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
-
- %>
- ]
-
- <%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
- %>
- <%= l(:label_course_submit_homework) %>
-
- <%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
-
-
- %>
- <%= format_time(homework.created_at) %>
- <% end %>
- <% end %>