班级配置-添加成员-角色编辑:将角色编辑为教师或助教单个角色时,点击保存无反应
This commit is contained in:
parent
650eb963b4
commit
18ea262f34
|
@ -40,7 +40,7 @@ class StudentsForCourse < ActiveRecord::Base
|
|||
|
||||
#加入班级时创建一条记录
|
||||
def create_course_homework_statistic
|
||||
if CourseHomeworkStatistic.where(:user_id => self.student_id, :course_id => self.course_id).count == 0
|
||||
if CourseHomeworkStatistics.where(:user_id => self.student_id, :course_id => self.course_id).count == 0
|
||||
course = self.course
|
||||
user = self.student
|
||||
hw_count = course.homework_commons.includes(:homework_detail_manual).where("homework_detail_manuals.comment_status > 0").count
|
||||
|
@ -63,13 +63,13 @@ class StudentsForCourse < ActiveRecord::Base
|
|||
appeal_num = user.student_works_scores.where(:student_work_id => student_works.map(&:id), :appeal_status => 3).count
|
||||
average_score = user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("AVG(student_works.work_score) as score").first.score : 0
|
||||
total_score = user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first ? user.student_works.where(:id => student_works.map(&:id)).select("SUM(student_works.work_score) as score").first.score : 0
|
||||
CourseHomeworkStatistic.create(:course_id => course.id, :user_id => user.id, :committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
|
||||
CourseHomeworkStatistics.create(:course_id => course.id, :user_id => user.id, :committed_work_num => committed_work_num, :un_commit_work_num => un_commit_work_num,
|
||||
:late_commit_work_num => late_commit_work_num, :absence_evaluation_work_num => absence_evaluation_work_num, :un_evaluation_work_num => un_evaluation_work_num,
|
||||
:appeal_num => appeal_num, :average_score => average_score, :total_score => total_score)
|
||||
end
|
||||
end
|
||||
|
||||
def delete_course_homework_statistic
|
||||
CourseHomeworkStatistic.where(:user_id => self.student_id, :course_id => self.course_id).destroy_all
|
||||
CourseHomeworkStatistics.where(:user_id => self.student_id, :course_id => self.course_id).destroy_all
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue