You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/competitions/competition_teams/course_detail.json.jbuilder

28 lines
1.0 KiB

total_students_count = 0
total_shixun_homework_count = 0
total_course_score = 0
json.courses @courses.each do |course|
students_count = course.students.count
total_students_count += students_count
total_shixun_homework_count += course['shixun_homework_count'].to_i
score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0)
total_course_score += score
teacher = course.teachers.where(user_id: @team_user_ids).first.user
json.creator teacher&.real_name
json.creator_login teacher&.login
json.course_name course.name
json.course_id course.id
json.students_count students_count
json.shixun_homework_count course['shixun_homework_count']
json.valid_count @course_myshixun_map.fetch(course.id, 0)
json.score score
end
json.total_course_count @courses.size
json.total_students_count total_students_count
json.total_shixun_homework_count total_shixun_homework_count
json.total_valid_count @course_myshixun_map.values.reduce(:+)
json.total_course_score total_course_score