commit
25f7e75a05
@ -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,6 @@
|
|||||||
|
class Ecs::GraduationSubitemsController < Ecs::BaseController
|
||||||
|
def index
|
||||||
|
subitems = current_year.ec_graduation_subitems.reorder('ec_graduation_requirements.position ASC, ec_graduation_subitems.position ASC')
|
||||||
|
@graduation_subitems = subitems.includes(:ec_graduation_requirement)
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,22 @@
|
|||||||
|
class Ecs::UsersController < Ecs::BaseController
|
||||||
|
skip_before_action :check_user_permission!
|
||||||
|
before_action :check_manager_permission!
|
||||||
|
|
||||||
|
def index
|
||||||
|
users = UserQuery.call(params)
|
||||||
|
|
||||||
|
@count = users.count
|
||||||
|
@users = paginate users.includes(user_extension: [:school, :department])
|
||||||
|
@manager_ids = current_major_school.ec_major_school_users.pluck(:user_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def current_major_school
|
||||||
|
@_ec_major_school ||= EcMajorSchool.find(params[:ec_major_school_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_school
|
||||||
|
@_current_school ||= current_major_school.school
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class LibraryTagsController < ApplicationController
|
||||||
|
def index
|
||||||
|
library_tags = LibraryTag.all
|
||||||
|
render_ok(library_tags: library_tags.as_json(only: %i[id name]), count: library_tags.size)
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,22 @@
|
|||||||
|
module Ecs::EcYearsHelper
|
||||||
|
def achieved_graduation_course_count(ec_year)
|
||||||
|
return 0 if ec_year.ec_courses.count.zero?
|
||||||
|
|
||||||
|
course_ids = ec_year.ec_courses.map(&:id)
|
||||||
|
target_count_map = EcCourseTarget.where(ec_course_id: course_ids).group(:ec_course_id).count
|
||||||
|
|
||||||
|
ec_year.ec_courses.sum { |course| course.complete_target_count == target_count_map[course.id] ? 1 : 0 }
|
||||||
|
end
|
||||||
|
|
||||||
|
def achieved_graduation_objective_count(ec_year)
|
||||||
|
return 0 if ec_year.ec_graduation_subitems.count.zero?
|
||||||
|
|
||||||
|
subitem_ids = ec_year.ec_graduation_subitems.reorder(nil).pluck(:id)
|
||||||
|
|
||||||
|
relations = EcGraduationRequirementCalculation.joins(:ec_course_support).where(ec_course_supports: { ec_graduation_subitem_id: subitem_ids })
|
||||||
|
|
||||||
|
reached_map = relations.where(status: true).group('ec_graduation_subitem_id').count
|
||||||
|
|
||||||
|
reached_map.keys.size
|
||||||
|
end
|
||||||
|
end
|
@ -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
|
@ -1,7 +1,6 @@
|
|||||||
class EcCourseStudentScore < ApplicationRecord
|
class EcCourseStudentScore < ApplicationRecord
|
||||||
belongs_to :ec_year_student
|
belongs_to :ec_year_student
|
||||||
belongs_to :ec_course
|
belongs_to :ec_course
|
||||||
belongs_to :ec_course_target
|
|
||||||
|
|
||||||
has_many :ec_student_score_targets, dependent: :delete_all
|
has_many :ec_student_score_targets, dependent: :delete_all
|
||||||
end
|
end
|
@ -0,0 +1,4 @@
|
|||||||
|
class SubjectAppointment < ApplicationRecord
|
||||||
|
belongs_to :subject
|
||||||
|
belongs_to :user
|
||||||
|
end
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
|||||||
|
class UserQuery < ApplicationQuery
|
||||||
|
attr_reader :params
|
||||||
|
|
||||||
|
def initialize(params)
|
||||||
|
@params = params
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
users = User.where(type: 'User')
|
||||||
|
|
||||||
|
# 真实姓名
|
||||||
|
if name = strip_param(:name)
|
||||||
|
users = users.where('LOWER(CONCAT(users.lastname, users.firstname)) LIKE ?', "%#{name.downcase}%")
|
||||||
|
end
|
||||||
|
|
||||||
|
# 单位名称
|
||||||
|
if school = strip_param(:school)
|
||||||
|
users = users.joins(user_extension: :school).where('schools.name LIKE ?', "%#{school}%")
|
||||||
|
end
|
||||||
|
|
||||||
|
# 职业
|
||||||
|
if (identity = strip_param(:identity)) && UserExtension.identities.keys.include?(identity)
|
||||||
|
users = users.joins(:user_extension).where(user_extensions: { identity: identity })
|
||||||
|
end
|
||||||
|
|
||||||
|
users
|
||||||
|
end
|
||||||
|
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
|
@ -1 +1 @@
|
|||||||
json.course_evaluations @course_evaluations, partial: 'shared/ec_course_evaluation', as: :ec_course_evaluation
|
json.course_evaluations @course_evaluations, partial: 'ecs/course_evaluations/shared/ec_course_evaluation', as: :ec_course_evaluation
|
||||||
|
@ -1 +1 @@
|
|||||||
json.partial! 'shared/ec_course_evaluation', ec_course_evaluation: @course_evaluation
|
json.partial! 'ecs/course_evaluations/shared/ec_course_evaluation', ec_course_evaluation: @course_evaluation
|
||||||
|
@ -1 +1 @@
|
|||||||
json.course_evaluations @course_evaluations, partial: 'shared/ec_course_evaluation_slim', as: :ec_course_evaluation
|
json.course_evaluations @course_evaluations, partial: 'ecs/course_evaluations/shared/ec_course_evaluation_slim', as: :ec_course_evaluation
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
json.course_targets @course_targets, partial: 'shared/course_target', as: :ec_course_target
|
json.course_targets @course_targets, partial: 'ecs/course_targets/shared/course_target', as: :ec_course_target
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
json.count @count
|
json.count @count
|
||||||
json.ec_courses @ec_courses, partial: 'shared/ec_course_slim', as: :ec_course
|
json.ec_courses @ec_courses, partial: 'ecs/ec_courses/shared/ec_course_slim', as: :ec_course
|
@ -1,3 +1,3 @@
|
|||||||
|
|
||||||
json.count @graduation_requirements.size
|
json.count @graduation_requirements.size
|
||||||
json.graduation_requirements @graduation_requirements, partial: 'shared/ec_graduation_requirement', as: :ec_graduation_requirement
|
json.graduation_requirements @graduation_requirements, partial: '/ecs/ec_graduation_requirements/shared/ec_graduation_requirement', as: :ec_graduation_requirement
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
|
|
||||||
json.partial! 'shared/ec_graduation_requirement', ec_graduation_requirement: @graduation_requirement
|
json.partial! 'ecs/ec_graduation_requirements/shared/ec_graduation_requirement', ec_graduation_requirement: @graduation_requirement
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
json.extract! @major, :id, :code, :name, :template_major
|
||||||
|
json.school_id @major.school.id
|
||||||
|
json.school_name @major.school.name
|
||||||
|
|
||||||
|
can_manager = @major.manager?(current_user) || @major.school.manager?(current_user) || current_user.admin_or_business?
|
||||||
|
json.can_manager can_manager
|
@ -1,2 +1,7 @@
|
|||||||
json.count @count
|
json.count @count
|
||||||
json.es_majors @ec_majors, partial: 'ecs/majors/shared/ec_major', as: :ec_major
|
json.ec_majors do
|
||||||
|
json.array! @ec_majors.each do |major|
|
||||||
|
json.extract! major, :id, :name, :code
|
||||||
|
json.selected @major_ids.include?(major.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
json.extract! ec_training_objective, :id, :content
|
json.extract! ec_training_objective, :id, :content
|
||||||
|
|
||||||
json.ec_training_items ec_training_objective.ec_training_subitems, partial: 'ec_training_subitem', as: :ec_training_subitem
|
json.ec_training_items ec_training_objective.ec_training_subitems, partial: '/ecs/ec_training_objectives/shared/ec_training_subitem', as: :ec_training_subitem
|
||||||
|
@ -1 +1 @@
|
|||||||
json.partial! 'shared/ec_training_objective', ec_training_objective: @training_objective
|
json.partial! '/ecs/ec_training_objectives/shared/ec_training_objective', ec_training_objective: @training_objective
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
json.extract! @year, :id, :year
|
||||||
|
|
||||||
|
major = @year.ec_major_school
|
||||||
|
json.major_id major.id
|
||||||
|
json.major_name major.name
|
||||||
|
json.major_code major.code
|
||||||
|
|
||||||
|
school = major.school
|
||||||
|
json.school_id school.id
|
||||||
|
json.school_name school.name
|
||||||
|
|
||||||
|
can_manager = major.manager?(current_user) || school.manager?(current_user) || current_user.admin_or_business?
|
||||||
|
json.can_manager can_manager
|
@ -1 +1 @@
|
|||||||
json.partial! 'shared/ec_graduation_subitem', ec_graduation_subitem: @graduation_subitem
|
json.partial! 'ecs/graduation_course_supports/shared/ec_graduation_subitem', ec_graduation_subitem: @graduation_subitem
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue