commit
da488e7baf
@ -0,0 +1,12 @@
|
||||
$(document).on('turbolinks:load', function(){
|
||||
$(document).on('click', '.batch-all-check-box', function(){
|
||||
var $checkAll = $(this);
|
||||
|
||||
$('.batch-check-box').prop('checked', $checkAll.is(':checked'));
|
||||
})
|
||||
|
||||
$(document).on('click', '.batch-check-box', function(){
|
||||
var allChecked = $('.batch-check-box:checked').length === $('.batch-check-box').length
|
||||
$('.batch-all-check-box').prop('checked', allChecked);
|
||||
})
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,22 @@
|
||||
class CreateSubjectCourseStudentJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(course_id)
|
||||
course = Course.find_by(id: course_id)
|
||||
return if course.blank? || course.subject.blank?
|
||||
|
||||
attrs = %i[course_id user_id role created_at updated_at]
|
||||
same_attrs = {course_id: course.id, role: 4}
|
||||
|
||||
Rails.logger.info("1:course.students.count:##{course.students.count}")
|
||||
CourseMember.bulk_insert(*attrs) do |worker|
|
||||
course.subject.subject_appointments.each do |app|
|
||||
Rails.logger.info("##{course.students.where(user_id: app.user_id)}")
|
||||
next if course.students.where(user_id: app.user_id).any?
|
||||
worker.add same_attrs.merge(user_id: app.user_id)
|
||||
end
|
||||
end
|
||||
Rails.logger.info("2:course.students.count:##{course.students.count}")
|
||||
course.subject.subject_appointments.destroy_all
|
||||
end
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
class SubjectAppointment < ApplicationRecord
|
||||
belongs_to :subject
|
||||
belongs_to :user
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
class Admins::IdentityAuths::RevokeApplyService < ApplicationService
|
||||
attr_reader :apply, :user
|
||||
|
||||
def initialize(apply)
|
||||
@apply = apply
|
||||
@user = apply.user
|
||||
end
|
||||
|
||||
def call
|
||||
ActiveRecord::Base.transaction do
|
||||
apply.revoke!
|
||||
user.update!(authentication: false)
|
||||
|
||||
deal_tiding!
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def deal_tiding!
|
||||
Tiding.create!(user_id: apply.user_id, trigger_user_id: 0,
|
||||
container_id: apply.id, container_type: 'CancelUserAuthentication',
|
||||
belong_container_id: apply.user_id, belong_container_type: 'User',
|
||||
status: 1, tiding_type: 'System')
|
||||
end
|
||||
end
|
@ -0,0 +1,26 @@
|
||||
class Admins::ProfessionalAuths::RevokeApplyService < ApplicationService
|
||||
attr_reader :apply, :user
|
||||
|
||||
def initialize(apply)
|
||||
@apply = apply
|
||||
@user = apply.user
|
||||
end
|
||||
|
||||
def call
|
||||
ActiveRecord::Base.transaction do
|
||||
apply.revoke!
|
||||
user.update!(professional_certification: false)
|
||||
|
||||
deal_tiding!
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def deal_tiding!
|
||||
Tiding.create!(user_id: apply.user_id, trigger_user_id: 0,
|
||||
container_id: apply.id, container_type: 'CancelUserProCertification',
|
||||
belong_container_id: apply.user_id, belong_container_type: 'User',
|
||||
status: 1, tiding_type: 'System')
|
||||
end
|
||||
end
|
@ -0,0 +1,6 @@
|
||||
class AddCourseMemberToSubjects < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :subjects, :student_count, :integer, :default => 0
|
||||
add_column :subjects, :participant_count, :integer, :default => 0
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateSubjectAppointments < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
create_table :subject_appointments do |t|
|
||||
t.references :subject, index: true
|
||||
t.references :user, index: true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue