newyslclassrooms
cxt 5 years ago
parent 8697ef983c
commit cc9dac4b67

@ -330,7 +330,7 @@ class ApplicationController < ActionController::Base
end end
if !User.current.logged? && Rails.env.development? if !User.current.logged? && Rails.env.development?
User.current = User.find 1 User.current = User.find 3117
end end

@ -62,11 +62,11 @@ class Weapps::AttendancesController < ApplicationController
where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'") where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'")
@history_count = @history_attendances.size @history_count = @history_attendances.size
# 当前签到如果存在快捷签到,则直接签到 # 当前签到如果存在快捷签到,则直接签到(不在这里处理)
quick_attendances = @current_attendances.where(mode: "QUICK") # quick_attendances = @current_attendances.where(mode: "QUICK")
if quick_attendances.present? # if quick_attendances.present?
student_direct_attendance quick_attendances, member # student_direct_attendance quick_attendances, member
end # end
student_attendance_ids = @history_attendances.pluck(:id) student_attendance_ids = @history_attendances.pluck(:id)
student_attendance_ids += @current_attendances.present? ? @current_attendances.pluck(:id) : [] student_attendance_ids += @current_attendances.present? ? @current_attendances.pluck(:id) : []

@ -28,19 +28,24 @@ class Weapps::CourseMemberAttendancesController < ApplicationController
end end
def create def create
tip_exception("签到码不能为空") if params[:code].blank? tip_exception("签到码不能为空") if params[:attendance_mode] != "QUICK" && params[:code].blank?
tip_exception("attendance_mode参数不对") unless ["NUMBER", "QRCODE"].include?(params[:attendance_mode]) tip_exception("attendance_mode参数不对") unless ["NUMBER", "QRCODE", "QUICK"].include?(params[:attendance_mode])
if params[:attendance_mode] == "QUICK"
attendance = CourseAttendance.find_by(id: params[:attendance_id])
else
attendance = CourseAttendance.find_by(attendance_code: params[:code]) attendance = CourseAttendance.find_by(attendance_code: params[:code])
tip_exception("签到码输入有误") if attendance.blank? || attendance.course.blank? end
tip_exception("该签到不存在") if attendance.blank? || attendance.course.blank?
member = attendance.course.students.find_by(user_id: current_user.id) member = attendance.course.students.find_by(user_id: current_user.id)
tip_exception("签到码输入有误") if member.blank? tip_exception("该签到不存在") if member.blank?
tip_exception("不在签到时间内") unless attendance.current_attendance? tip_exception("不在签到时间内") unless attendance.current_attendance?
tip_exception("只支持数字签到") if attendance.mode != "ALL" && attendance.mode == "NUMBER" && params[:attendance_mode] == "QRCODE" tip_exception("只支持数字签到") if attendance.mode != "ALL" && attendance.mode == "NUMBER" && params[:attendance_mode] != "NUMBER"
tip_exception("只支持二维码签到") if attendance.mode != "ALL" && attendance.mode == "QRCODE" && params[:attendance_mode] == "NUMBER" tip_exception("只支持二维码签到") if attendance.mode != "ALL" && attendance.mode == "QRCODE" && params[:attendance_mode] != "QRCODE"
tip_exception("只支持快捷签到") if attendance.mode == "QUICK" && params[:attendance_mode] != "QUICK"
current_attendance = attendance.course_member_attendances.find_by(user_id: current_user.id) current_attendance = attendance.course_member_attendances.find_by(user_id: current_user.id)
if current_attendance.present? if current_attendance.present?

Loading…
Cancel
Save