|
|
|
@ -58,12 +58,18 @@ class Weapps::AttendancesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
@history_attendances = @course.course_attendances.where(id: history_attendance_ids.uniq).
|
|
|
|
|
where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')").order("id desc")
|
|
|
|
|
@current_attendance = @course.course_attendances.where(id: all_attendance_ids.uniq).
|
|
|
|
|
@current_attendances = @course.course_attendances.where(id: all_attendance_ids.uniq).
|
|
|
|
|
where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'")
|
|
|
|
|
@history_count = @history_attendances.size
|
|
|
|
|
|
|
|
|
|
# 当前签到如果存在快捷签到,则直接签到
|
|
|
|
|
quick_attendances = @current_attendances.where(mode: "QUICK")
|
|
|
|
|
if quick_attendances.present?
|
|
|
|
|
student_direct_attendance quick_attendances, member
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
student_attendance_ids = @history_attendances.pluck(:id)
|
|
|
|
|
student_attendance_ids += @current_attendance.present? ? @current_attendance.pluck(:id) : []
|
|
|
|
|
student_attendance_ids += @current_attendances.present? ? @current_attendances.pluck(:id) : []
|
|
|
|
|
|
|
|
|
|
if student_attendance_ids.uniq.blank?
|
|
|
|
|
@normal_count = 0
|
|
|
|
@ -141,4 +147,8 @@ class Weapps::AttendancesController < ApplicationController
|
|
|
|
|
def edit_auth
|
|
|
|
|
tip_exception(403, "") unless @user_course_identity < Course::PROFESSOR || @attendance.user_id == current_user.id
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def student_direct_attendance quick_attendances, member
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|