Merge branch 'dev_cs' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_cs
commit
35fd1fe909
@ -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
@ -1,47 +1,56 @@
|
||||
import React, { Component } from 'react';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import { Spin, Icon , Modal} from 'antd';
|
||||
class Modals extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
funmodalsType:false,
|
||||
istype:false
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const antIcons = <Icon type="loading" style={{ fontSize: 24 }} spin />
|
||||
return(
|
||||
<Modal
|
||||
className={this.props.className}
|
||||
keyboard={false}
|
||||
title="提示"
|
||||
visible={this.props.modalsType===undefined?false:this.props.modalsType}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
centered={true}
|
||||
width="530px"
|
||||
>
|
||||
<Spin indicator={antIcons} spinning={this.props.antIcon===undefined?false:this.props.antIcon} >
|
||||
<div className="task-popup-content">
|
||||
<p className="task-popup-text-center font-16">{this.props.modalsTopval}</p>
|
||||
<p className="task-popup-text-center font-16 mt5">{this.props.modalsBottomval}</p>
|
||||
{this.props.loadtype===true?
|
||||
<div className="clearfix edu-txt-center mt20">
|
||||
<a className="task-btn task-btn-orange pop_close" onClick={this.props.modalSave}>知道啦</a>
|
||||
</div>
|
||||
:
|
||||
<div className="clearfix mt30 edu-txt-center">
|
||||
<a className="task-btn mr30" onClick={this.props.modalCancel}>取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.props.modalSave}>{this.props.okText || '确定'}</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import {getImageUrl} from 'educoder';
|
||||
import { Spin, Icon , Modal} from 'antd';
|
||||
class Modals extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
funmodalsType:false,
|
||||
istype:false
|
||||
}
|
||||
}
|
||||
render() {
|
||||
const antIcons = <Icon type="loading" style={{ fontSize: 24 }} spin />
|
||||
return(
|
||||
<Modal
|
||||
className={this.props.className}
|
||||
keyboard={false}
|
||||
title="提示"
|
||||
visible={this.props.modalsType===undefined?false:this.props.modalsType}
|
||||
closable={false}
|
||||
footer={null}
|
||||
destroyOnClose={true}
|
||||
centered={true}
|
||||
width="530px"
|
||||
>
|
||||
{this.props.modalsType===true?<style>
|
||||
{
|
||||
`
|
||||
body{
|
||||
overflow: hidden !important;
|
||||
}
|
||||
`
|
||||
}
|
||||
</style>:""}
|
||||
<Spin indicator={antIcons} spinning={this.props.antIcon===undefined?false:this.props.antIcon} >
|
||||
<div className="task-popup-content">
|
||||
<p className="task-popup-text-center font-16">{this.props.modalsTopval}</p>
|
||||
<p className="task-popup-text-center font-16 mt5">{this.props.modalsBottomval}</p>
|
||||
{this.props.loadtype===true?
|
||||
<div className="clearfix edu-txt-center mt20">
|
||||
<a className="task-btn task-btn-orange pop_close" onClick={this.props.modalSave}>知道啦</a>
|
||||
</div>
|
||||
:
|
||||
<div className="clearfix mt30 edu-txt-center">
|
||||
<a className="task-btn mr30" onClick={this.props.modalCancel}>取消</a>
|
||||
<a className="task-btn task-btn-orange" onClick={this.props.modalSave}>{this.props.okText || '确定'}</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</Spin>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Modals;
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe CreateSubjectCourseStudentJob, type: :job do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe SubjectAppointment, type: :model do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue