签到统计的调整

courseware
cxt 5 years ago
parent 80fed1d5d3
commit 4e2c9e42ba

@ -52,10 +52,12 @@ class AttendancesController < ApplicationController
current_end_time = Time.current.strftime("%H:%M:%S")
history_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or
(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?
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
history_attendances = history_attendances.order("attendance_date desc, start_time desc")

Loading…
Cancel
Save