优化作业弹出框效率
This commit is contained in:
parent
38a912672a
commit
f5b1cbcfe4
|
@ -372,11 +372,11 @@ class HomeworkAttachController < ApplicationController
|
|||
def show
|
||||
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
|
||||
# 打分统计
|
||||
stars_reates = @homework. rates(:quality)
|
||||
#stars_reates = @homework. rates(:quality)
|
||||
#是否已经进行过评价
|
||||
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first
|
||||
@m_score = temp.nil? ? 0:temp.stars
|
||||
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
|
||||
@has_evaluation = @homework.has_rated?( User.current,:quality)
|
||||
#@jours留言 is null条件用以兼容历史数据
|
||||
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
|
||||
@cur_page = params[:cur_page] || 1
|
||||
|
@ -385,13 +385,17 @@ class HomeworkAttachController < ApplicationController
|
|||
|
||||
teachers = searchTeacherAndAssistant @course
|
||||
@comprehensive_evaluation = []
|
||||
#JourForMessage的is_comprehensive_evaluation字段:
|
||||
#1:老师评价
|
||||
#2:学生评价
|
||||
#3 || null:学生留言
|
||||
teachers.each do|teacher|
|
||||
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
|
||||
@comprehensive_evaluation << temp if temp
|
||||
end
|
||||
annymous_users = @homework.homework_evaluations.map(&:user)
|
||||
unless annymous_users.nil? || annymous_users.count == 0
|
||||
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
|
||||
annymous_users = @homework.homework_evaluations.map { |homework_evaluation| homework_evaluation.user.id}.join(',')
|
||||
unless annymous_users.nil? || annymous_users == ""
|
||||
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in (#{annymous_users})").order("created_on DESC")
|
||||
end
|
||||
#@totle_score = score_for_homework @homework
|
||||
#@teaher_score = teacher_score_for_homework @homework
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function submit1(button)
|
||||
function submit1()
|
||||
{
|
||||
$('#jours_submit').parent().submit();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue