Merge branch 'szzh' into dev_hjq

This commit is contained in:
huang 2015-06-08 14:38:59 +08:00
commit 4f9459dfef
3 changed files with 25 additions and 14 deletions

View File

@ -107,6 +107,7 @@ class Mailer < ActionMailer::Base
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) @issues = Issue.find_by_sql(sql)
# @bids 查询课程作业包括老师发布的作业以及user提交作业 # @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新 # @attachments查询课程课件更新
@attachments ||= [] @attachments ||= []
@ -125,21 +126,29 @@ 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在课程。项目中发布的讨论帖子 # 查询user在课程中发布的讨论帖子
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where course_mesages = 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") 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
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") # 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 ||= [] @course_messages ||= []
@project_messages ||= [] @project_messages ||= []
unless messages.first.nil? unless course_mesages.first.nil?
messages.each do |msg| course_mesages.each do |msg|
if msg.project @course_messages << msg
@project_messages << msg
elsif msg.course
@course_messages << msg
end
end end
end end
unless project_messages.first.nil?
project_messages.each do |msg|
@project_messages << msg
end
end
# wiki
# 查询user在课程中发布的通知项目中发的新闻 # 查询user在课程中发布的通知项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
@ -157,7 +166,7 @@ class Mailer < ActionMailer::Base
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
@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})) @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") and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
puts @attachments
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].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"

View File

@ -6,13 +6,15 @@
<span> <span>
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</span> </span>
<% else%>
<span class="ml30">--</span>
<% end%> <% end%>
</li> </li>
<li class="hwork_name"> <li class="hwork_name">
<% if is_my_work%> <% if is_my_work%>
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name %> <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %>
<% else%> <% else%>
<%= link_to "匿名","javascript:void(0)"%> <%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%>
<% end%> <% end%>
</li> </li>
<li class=" hwork_tit_e" style="width: 410px"> <li class=" hwork_tit_e" style="width: 410px">

View File

@ -6,7 +6,7 @@
</span> </span>
</li> </li>
<li class=" hwork_name "> <li class=" hwork_name ">
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name%> <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
</li> </li>
<li class=" hwork_tit"> <li class=" hwork_tit">
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>