Merge branch 'szzh' into develop
This commit is contained in:
commit
d29353dd1a
|
@ -10,7 +10,7 @@ module Mobile
|
|||
else
|
||||
f[field]
|
||||
end
|
||||
elsif f.is_a?(::Bid)
|
||||
elsif f.is_a?(::HomeworkCommon)
|
||||
if f.respond_to?(field)
|
||||
f.send(field)
|
||||
else
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -330,7 +330,7 @@ class CoursesService
|
|||
def homework_list params,current_user
|
||||
course = Course.find(params[:id])
|
||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||
bids = course.homeworks.order('deadline DESC')
|
||||
bids = course.homework_commons.order('end_time DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
|
@ -375,9 +375,9 @@ class CoursesService
|
|||
unless latest_attachment.nil?
|
||||
latest_course_dynamics << {:type => 3,:time => latest_attachment.created_on,:message =>latest_attachment.author.realname<< l(:label_recently_updated_courseware,:locale => get_user_language(current_user))<<":"<<latest_attachment.filename}
|
||||
end
|
||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
||||
latest_bid = course.homework_commons.order('updated_at DESC').first
|
||||
unless latest_bid.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_on,:message => latest_bid.author.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<latest_bid.name}
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid.updated_at,:message => latest_bid.user.realname<<l(:label_recently_updated_homework,:locale => get_user_language(current_user))<<":"<<latest_bid.name}
|
||||
end
|
||||
|
||||
# Time 2015-04-07 14:58:30
|
||||
|
@ -390,24 +390,24 @@ class CoursesService
|
|||
|
||||
|
||||
#每个作业中的最新留言
|
||||
messages = []
|
||||
course.homeworks.each do |bid|
|
||||
jour = bid.journals_for_messages.order("created_on desc").first
|
||||
unless jour.nil?
|
||||
messages << jour
|
||||
end
|
||||
end
|
||||
unless messages.count == 0
|
||||
messages.sort!{|order,newer| newer.created_on <=> order.created_on}
|
||||
end
|
||||
latest_bid_message = messages.first
|
||||
unless latest_bid_message.nil?
|
||||
latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
|
||||
end
|
||||
# messages = []
|
||||
# course.homework_commons.each do |hc|
|
||||
# jour = hc.journals_for_messages.order("created_on desc").first
|
||||
# unless jour.nil?
|
||||
# messages << jour
|
||||
# end
|
||||
# end
|
||||
# unless messages.count == 0
|
||||
# messages.sort!{|order,newer| newer.created_on <=> order.created_on}
|
||||
# end
|
||||
# latest_bid_message = messages.first
|
||||
# unless latest_bid_message.nil?
|
||||
# latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
|
||||
# end
|
||||
#每个作业中学生最后提交的作业
|
||||
homeworks = []
|
||||
course.homeworks.each do |bid|
|
||||
homework_attach = bid.homeworks.order('updated_at DESC').first
|
||||
course.homework_commons.each do |bid|
|
||||
homework_attach = bid.student_works.order('updated_at DESC').first
|
||||
unless homework_attach.nil?
|
||||
homeworks << homework_attach
|
||||
end
|
||||
|
@ -533,21 +533,21 @@ class CoursesService
|
|||
mems
|
||||
end
|
||||
def show_homework_info course,bid,current_user,is_course_teacher
|
||||
author_real_name = bid.author.lastname + bid.author.firstname
|
||||
many_times = course.homeworks.index(bid) + 1
|
||||
author_real_name = bid.user.lastname + bid.user.firstname
|
||||
many_times = course.homework_commons.index(bid) + 1
|
||||
name = bid.name
|
||||
homework_count = bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
homework_count = bid.student_works.count #已提交的作业数量
|
||||
#student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = bid.comment_status
|
||||
state = bid.homework_detail_manual.comment_status
|
||||
unless is_course_teacher
|
||||
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
||||
end
|
||||
#end
|
||||
open_anonymous_evaluation = bid.open_anonymous_evaluation
|
||||
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.author,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_on,:deadline => bid.deadline}
|
||||
open_anonymous_evaluation = bid.homework_detail_manual.comment_status
|
||||
{:course_name => course.name,:course_id => course.id,:id => bid.id, :author => bid.user,:author_real_name => author_real_name, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments,:created_on => bid.created_at,:deadline => bid.end_time}
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -14,21 +14,21 @@ class HomeworkService
|
|||
# state=1 关闭匿评
|
||||
# state=2 匿评结束
|
||||
def show_homework params
|
||||
@bid = Bid.find(params[:id])
|
||||
course = @bid.courses.first
|
||||
author = @bid.author.lastname + @bid.author.firstname
|
||||
many_times = course.homeworks.index(@bid) + 1
|
||||
@bid = HomeworkCommon.find(params[:id])
|
||||
course = @bid.course
|
||||
author = @bid.user.lastname + @bid.user.firstname
|
||||
many_times = course.homework_commons.index(@bid) + 1
|
||||
name = @bid.name
|
||||
homework_count = @bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
homework_count = @bid.student_works.count #已提交的作业数量
|
||||
#student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = @bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = @bid.comment_status
|
||||
state = @bid.homework_detail_manual.comment_status
|
||||
#end
|
||||
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
||||
jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
{:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.author,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_on,:deadline => @bid.deadline,:jours => jours}
|
||||
open_anonymous_evaluation = @bid.homework_type
|
||||
#jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
{:course_name => course.name,:course_id => course.id,:id => @bid.id, :author => @bid.user,:author_real_name =>author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => 0,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_at,:deadline => @bid.end_time,:jours => nil}
|
||||
end
|
||||
|
||||
# 启动作业匿评前提示信息
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_borad_course) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_messages.count %>)</span>
|
||||
</h4>
|
||||
<% @course_messages.each do |course_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<% unless @course_messages.first.nil? %>
|
||||
|
||||
<%= l(:view_borad_course) %>
|
||||
(<%= @course_journal_messages.count %>)
|
||||
(<%= @course_messages.count %>)
|
||||
|
||||
|
||||
<% @course_messages.each do |course_message|%>
|
||||
|
|
Loading…
Reference in New Issue