|
|
|
@ -26,8 +26,8 @@ class HomeworkService
|
|
|
|
|
state = @bid.comment_status
|
|
|
|
|
#end
|
|
|
|
|
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
|
|
|
|
{:course_name => course.name,: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}
|
|
|
|
|
{: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}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 启动作业匿评前提示信息
|
|
|
|
@ -274,10 +274,26 @@ class HomeworkService
|
|
|
|
|
membership.each do |mp|
|
|
|
|
|
my_homeworks = []
|
|
|
|
|
mp.course.homeworks.each do |bid|
|
|
|
|
|
hw = bid.homeworks.where("user_id = #{current_user.id}")
|
|
|
|
|
my_homeworks << hw[0] unless (hw.nil? || hw[0].nil?)
|
|
|
|
|
#hw = bid.homeworks.where("user_id = #{current_user.id}")
|
|
|
|
|
@bid = bid
|
|
|
|
|
course = @bid.courses.first
|
|
|
|
|
author = @bid.author.lastname + @bid.author.firstname
|
|
|
|
|
many_times = course.homeworks.index(@bid) + 1
|
|
|
|
|
name = @bid.name
|
|
|
|
|
homework_count = @bid.homeworks.count #已提交的作业数量
|
|
|
|
|
student_questions_count = @bid.commit.nil? ? 0 : @bid.commit
|
|
|
|
|
description = @bid.description
|
|
|
|
|
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
|
|
|
|
state = @bid.comment_status
|
|
|
|
|
#end
|
|
|
|
|
open_anonymous_evaluation = @bid.open_anonymous_evaluation
|
|
|
|
|
|
|
|
|
|
my_homeworks << {:course_name => course.name,: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}
|
|
|
|
|
end
|
|
|
|
|
if mp.course.homeworks.count != 0
|
|
|
|
|
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks,:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
|
|
|
|
|
end
|
|
|
|
|
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:my_homework => my_homeworks,:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
|
|
|
|
|
end
|
|
|
|
|
course_list
|
|
|
|
|
end
|
|
|
|
|