Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
dd27e1c301
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
# 启动作业匿评前提示信息
|
||||
|
|
Loading…
Reference in New Issue