|
|
@ -52,10 +52,12 @@ class AttendancesController < ApplicationController
|
|
|
|
current_end_time = Time.current.strftime("%H:%M:%S")
|
|
|
|
current_end_time = Time.current.strftime("%H:%M:%S")
|
|
|
|
history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
|
|
|
|
history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
|
|
|
|
(attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
|
|
|
|
(attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
|
|
|
|
all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances)
|
|
|
|
|
|
|
|
if params[:group_id].present?
|
|
|
|
if params[:group_id].present?
|
|
|
|
history_attendances = history_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [params[:group_id], 0]})
|
|
|
|
history_attendances = history_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [params[:group_id], 0]})
|
|
|
|
all_member_attendances = all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]})
|
|
|
|
all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances)
|
|
|
|
|
|
|
|
.joins(:course_member).where(course_members: {course_group_id: params[:group_id]})
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
all_member_attendances = CourseMemberAttendance.where(course_attendance_id: history_attendances)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
history_attendances = history_attendances.order("attendance_date desc, start_time desc")
|
|
|
|
history_attendances = history_attendances.order("attendance_date desc, start_time desc")
|
|
|
|