diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b7a74cbc1..90a5e494e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -321,7 +321,7 @@ class ApplicationController < ActionController::Base end if !User.current.logged? && Rails.env.development? - User.current = User.find 3117 + User.current = User.find 1 end diff --git a/app/controllers/weapps/attendances_controller.rb b/app/controllers/weapps/attendances_controller.rb index 49c5c412d..da305bf8b 100644 --- a/app/controllers/weapps/attendances_controller.rb +++ b/app/controllers/weapps/attendances_controller.rb @@ -14,7 +14,7 @@ class Weapps::AttendancesController < ApplicationController group_ids.each do |group_id| @course.course_attendance_groups.create!(course_group_id: group_id, course_attendance: attendance) end - CreateStudentAttendanceRecordJob.perform_now(attendance.id, group_ids) + CreateStudentAttendanceRecordJob.perform_later(attendance.id, group_ids) else @course.course_attendance_groups.create!(course_group_id: 0, course_attendance: attendance) CreateStudentAttendanceRecordJob.perform_later(attendance.id, [0]) diff --git a/app/controllers/weapps/courses_controller.rb b/app/controllers/weapps/courses_controller.rb index 2fa3e0693..e1ceb6fd3 100644 --- a/app/controllers/weapps/courses_controller.rb +++ b/app/controllers/weapps/courses_controller.rb @@ -16,7 +16,7 @@ class Weapps::CoursesController < Weapps::BaseController current_date = Date.current current_end_time = Time.current.strftime("%H:%M:%S") if @user_course_identity == Course::STUDENT - attendances = attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: member.try(:course_group_id).to_i}) + attendances = attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [member.try(:course_group_id).to_i, 0]}) .where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and start_time < '#{current_end_time}')") end attendance_ids = attendances.blank? ? "(-1)" : "(" + attendances.pluck(:id).join(",") + ")"