|
|
|
@ -9,7 +9,22 @@ json.attendance_date @attendance.attendance_date.strftime("%Y/%m/%d")
|
|
|
|
|
json.start_time @attendance.start_time.strftime("%H:%M")
|
|
|
|
|
json.end_time @attendance.end_time.strftime("%H:%M")
|
|
|
|
|
|
|
|
|
|
json.course_groups @groups do |group|
|
|
|
|
|
json.(group, :id, :name, :course_members_count)
|
|
|
|
|
json.attendance_count group_attendance_count(@all_attendances, group) if @_is_current_attendance
|
|
|
|
|
# json.course_groups @group_ids do |group|
|
|
|
|
|
# json.(group, :id, :name, :course_members_count)
|
|
|
|
|
# json.attendance_count group_attendance_count(@all_attendances, group) if @_is_current_attendance
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
json.course_groups @group_ids do |group_id|
|
|
|
|
|
if group_id != 0
|
|
|
|
|
group = @groups.select{|group| group.id == group_id}.first
|
|
|
|
|
json.(group, :id, :name, :course_members_count)
|
|
|
|
|
else
|
|
|
|
|
json.id 0
|
|
|
|
|
json.name "未分班"
|
|
|
|
|
json.course_members_count @course.none_group_count
|
|
|
|
|
end
|
|
|
|
|
if @_is_current_attendance
|
|
|
|
|
member_ids = @course_members.select{|member| member.course_group_id == group_id}.map(&:id)
|
|
|
|
|
json.attendance_count group_attendance_count(@all_attendances, member_ids)
|
|
|
|
|
end
|
|
|
|
|
end
|