未开始的签到也可以截止

courseware
cxt 5 years ago
parent 7ca2f338fe
commit 5c39b86f66

@ -130,8 +130,14 @@ class Weapps::AttendancesController < ApplicationController
def end
a_end_time = "#{@attendance.attendance_date} #{@attendance.end_time}".to_time
tip_exception("该签到已截止") unless @attendance.current_attendance?
@attendance.update!(end_time: Time.current)
tip_exception("该签到已截止") if a_end_time < Time.now
a_start_time = "#{@attendance.attendance_date} #{@attendance.start_time}".to_time
if a_start_time > Time.now
@attendance.update!(end_time: Time.current, start_time: Time.current)
else
@attendance.update!(end_time: Time.current)
end
render_ok
end

Loading…
Cancel
Save