Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

newyslclassrooms
daiao 5 years ago
commit 1cf8c32188

@ -130,7 +130,7 @@ class CoursesController < ApplicationController
category = @course.course_second_categories.find_by(id: params[:new_category_id])
if params[:new_category_id].to_i == 0 || category.present?
videos = @course.course_videos.where(id: params[:video_ids])
videos = @course.course_videos.where(video_id: params[:video_ids])
videos.update_all(course_second_category_id: params[:new_category_id])
normal_status(0, "操作成功")

@ -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

@ -1,6 +1,6 @@
class CourseAttendance < ApplicationRecord
# status: 0: 未开启1已开启2已截止
# mode: 0 两种签到1 二维码签到2 数字签到
# mode: 0 两种签到1 二维码签到2 数字签到3 快捷签到
enum mode: { ALL: 0, QRCODE: 1, NUMBER: 2, QUICK: 3 }
belongs_to :course

@ -1,4 +1,4 @@
json.current_attendance @current_attendance do |attendance|
json.current_attendance @current_attendances do |attendance|
json.partial! 'student_attendance', locals: {attendance: attendance}
end

Loading…
Cancel
Save