From e88c4f3d535c03babc3585f94414a5cad1541480 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 5 Mar 2020 01:25:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=AD=BE=E5=88=B0=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- app/controllers/weapps/attendances_controller.rb | 2 +- app/controllers/weapps/courses_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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(",") + ")"