Merge branch 'szzh' into dev_hjq
This commit is contained in:
commit
dd27e1c301
|
@ -10,7 +10,7 @@ module Mobile
|
||||||
else
|
else
|
||||||
f[field]
|
f[field]
|
||||||
end
|
end
|
||||||
elsif f.is_a?(::Bid)
|
elsif f.is_a?(::HomeworkCommon)
|
||||||
if f.respond_to?(field)
|
if f.respond_to?(field)
|
||||||
f.send(field)
|
f.send(field)
|
||||||
else
|
else
|
||||||
|
|
|
@ -330,7 +330,7 @@ class CoursesService
|
||||||
def homework_list params,current_user
|
def homework_list params,current_user
|
||||||
course = Course.find(params[:id])
|
course = Course.find(params[:id])
|
||||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
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?
|
bids = bids.like(params[:name]) if params[:name].present?
|
||||||
homeworks = []
|
homeworks = []
|
||||||
bids.each do |bid|
|
bids.each do |bid|
|
||||||
|
@ -375,9 +375,9 @@ class CoursesService
|
||||||
unless latest_attachment.nil?
|
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}
|
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
|
end
|
||||||
latest_bid = course.homeworks.order('updated_on DESC').first
|
latest_bid = course.homework_commons.order('updated_at DESC').first
|
||||||
unless latest_bid.nil?
|
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
|
end
|
||||||
|
|
||||||
# Time 2015-04-07 14:58:30
|
# Time 2015-04-07 14:58:30
|
||||||
|
@ -390,24 +390,24 @@ class CoursesService
|
||||||
|
|
||||||
|
|
||||||
#每个作业中的最新留言
|
#每个作业中的最新留言
|
||||||
messages = []
|
# messages = []
|
||||||
course.homeworks.each do |bid|
|
# course.homework_commons.each do |hc|
|
||||||
jour = bid.journals_for_messages.order("created_on desc").first
|
# jour = hc.journals_for_messages.order("created_on desc").first
|
||||||
unless jour.nil?
|
# unless jour.nil?
|
||||||
messages << jour
|
# messages << jour
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
unless messages.count == 0
|
# unless messages.count == 0
|
||||||
messages.sort!{|order,newer| newer.created_on <=> order.created_on}
|
# messages.sort!{|order,newer| newer.created_on <=> order.created_on}
|
||||||
end
|
# end
|
||||||
latest_bid_message = messages.first
|
# latest_bid_message = messages.first
|
||||||
unless latest_bid_message.nil?
|
# 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))}
|
# latest_course_dynamics << {:type => 4,:time => latest_bid_message.created_on,:message => l(:label_recently_updated_message,:locale => get_user_language(current_user))}
|
||||||
end
|
# end
|
||||||
#每个作业中学生最后提交的作业
|
#每个作业中学生最后提交的作业
|
||||||
homeworks = []
|
homeworks = []
|
||||||
course.homeworks.each do |bid|
|
course.homework_commons.each do |bid|
|
||||||
homework_attach = bid.homeworks.order('updated_at DESC').first
|
homework_attach = bid.student_works.order('updated_at DESC').first
|
||||||
unless homework_attach.nil?
|
unless homework_attach.nil?
|
||||||
homeworks << homework_attach
|
homeworks << homework_attach
|
||||||
end
|
end
|
||||||
|
@ -533,21 +533,21 @@ class CoursesService
|
||||||
mems
|
mems
|
||||||
end
|
end
|
||||||
def show_homework_info course,bid,current_user,is_course_teacher
|
def show_homework_info course,bid,current_user,is_course_teacher
|
||||||
author_real_name = bid.author.lastname + bid.author.firstname
|
author_real_name = bid.user.lastname + bid.user.firstname
|
||||||
many_times = course.homeworks.index(bid) + 1
|
many_times = course.homework_commons.index(bid) + 1
|
||||||
name = bid.name
|
name = bid.name
|
||||||
homework_count = bid.homeworks.count #已提交的作业数量
|
homework_count = bid.student_works.count #已提交的作业数量
|
||||||
student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
#student_questions_count = bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||||
description = bid.description
|
description = bid.description
|
||||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
#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
|
unless is_course_teacher
|
||||||
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
||||||
end
|
end
|
||||||
#end
|
#end
|
||||||
open_anonymous_evaluation = bid.open_anonymous_evaluation
|
open_anonymous_evaluation = bid.homework_detail_manual.comment_status
|
||||||
{: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,
|
{: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_on,:deadline => bid.deadline}
|
: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
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,21 +14,21 @@ class HomeworkService
|
||||||
# state=1 关闭匿评
|
# state=1 关闭匿评
|
||||||
# state=2 匿评结束
|
# state=2 匿评结束
|
||||||
def show_homework params
|
def show_homework params
|
||||||
@bid = Bid.find(params[:id])
|
@bid = HomeworkCommon.find(params[:id])
|
||||||
course = @bid.courses.first
|
course = @bid.course
|
||||||
author = @bid.author.lastname + @bid.author.firstname
|
author = @bid.user.lastname + @bid.user.firstname
|
||||||
many_times = course.homeworks.index(@bid) + 1
|
many_times = course.homework_commons.index(@bid) + 1
|
||||||
name = @bid.name
|
name = @bid.name
|
||||||
homework_count = @bid.homeworks.count #已提交的作业数量
|
homework_count = @bid.student_works.count #已提交的作业数量
|
||||||
student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
#student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||||
description = @bid.description
|
description = @bid.description
|
||||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
#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
|
#end
|
||||||
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
open_anonymous_evaluation = @bid.homework_type
|
||||||
jours = @bid.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
#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,
|
{: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_on,:deadline => @bid.deadline,:jours => jours}
|
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:created_on => @bid.created_at,:deadline => @bid.end_time,:jours => nil}
|
||||||
end
|
end
|
||||||
|
|
||||||
# 启动作业匿评前提示信息
|
# 启动作业匿评前提示信息
|
||||||
|
|
Loading…
Reference in New Issue