Merge branches 'dev_aliyun' and 'develop' of https://bdgit.educoder.net/Hjqreturn/educoder into develop

dev_auth
杨树明 5 years ago
commit e22473cc15

@ -45,12 +45,14 @@ class ExercisePublishTask
Rails.logger.info("log--------------------------------exercise_end start")
puts "--------------------------------exercise_end start"
# 1。统一设置的试卷
exercises = Exercise.includes(:exercise_users,:exercise_questions).where("exercise_status = 2 AND unified_setting = true AND end_time <= ?",Time.now + 900)
exercises = Exercise.includes(:exercise_users,:exercise_questions).where("exercise_status = 2 AND
unified_setting = true AND end_time <= ?",Time.now + 900)
exercises&.each do |exercise|
ex_type = exercise.exercise_questions.pluck(:question_type).uniq
exercise.update_column('exercise_status', 3)
exercise.exercise_users&.each do |exercise_user|
begin
Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}")
if (exercise_user&.commit_status == 0) && (exercise_user&.start_at.present?)
s_score = calculate_student_score(exercise, exercise_user.user)[:total_score]
if ex_type.include?(4) #是否包含主观题
@ -60,6 +62,9 @@ class ExercisePublishTask
end
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = s_score + total_score_subjective_score
Rails.logger.info("true: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}")
Rails.logger.info("true: user_id:#{exercise_user.user_id}--s_score:#{s_score}")
Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}")
commit_option = {
:status => 1,
:commit_status => 1,
@ -94,6 +99,7 @@ class ExercisePublishTask
exercise_users = exercise.exercise_users.where(:user_id => users.pluck(:user_id))
exercise_users&.each do |exercise_user|
begin
Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}")
if exercise_user.commit_status == 0 && !exercise_user.start_at.nil?
if ex_types.include?(4) #是否包含主观题
subjective_score = exercise_user.subjective_score
@ -103,6 +109,9 @@ class ExercisePublishTask
s_score = calculate_student_score(exercise, exercise_user.user)[:total_score]
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
total_score = s_score + total_score_subjective_score
Rails.logger.info("false: user_id:#{exercise_user.user_id}--s_score:#{s_score}")
Rails.logger.info("false: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}")
Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}")
commit_option = {
:status => 1,
:commit_status => 1,

@ -50,10 +50,14 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
application_id: record.application_id,
approval: approval,
group_id: arg_course_groups
})
props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
fetchAll(1)
modalEl.current.setVisible(false)
}).then((result) => {
if (result.data.status === 0) {
props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
fetchAll(1)
modalEl.current.setVisible(false)
window.location.reload();
}})
}
return (
<ModalWrapper

@ -258,7 +258,7 @@ class studentsList extends Component{
// approval 2 - 拒绝
onAgree = (record, approval = 1) => {
const isAdminOrCreator = this.props.isAdminOrCreator()
const { course_groups } = this.state
const { course_groups ,filterKey} = this.state
if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) {
this.setState({ clickRecord: record}, () => {
this.setGroupChooserModalVisible(true)
@ -280,7 +280,7 @@ class studentsList extends Component{
.then((response) => {
if (response.data.status == 0) {
this.props.showNotification(`${approval == 1? '同意' : '拒绝'}`)
this.fetchAll(1)
this.fetchAll(1,filterKey)
}
})
.catch(function (error) {
@ -304,13 +304,15 @@ class studentsList extends Component{
this.setState({
filterKey:'1'
})
this.fetchAll(1,'1');
}else{
this.setState({
filterKey:'2'
})
this.fetchAll(1,'2');
}
this.fetchAll(1);
const isAdminOrTeacher = this.props.isAdminOrTeacher()
const isAdmin = this.props.isAdmin()
@ -330,10 +332,11 @@ class studentsList extends Component{
this.getCourseGroups()
}
addTeacherSuccessListener = (e, data) => {
// const params = JSON.parse(data)
// const coursesId = this.props.match.params.coursesId
if (window.location.pathname.endsWith('teachers')) {
this.fetchAll(1)
this.fetchAll(1,this.state.filterKey)
} else {
// this.props.history.push(`/courses/${coursesId}/teachers`)
}
@ -393,10 +396,10 @@ class studentsList extends Component{
});
}
onChangeRoleSuccess = () => {
this.fetchAll()
this.fetchAll(undefined,this.state.filterKey)
}
fetchAll = async (argPage) => {
let { searchValue, filterKey }=this.state
fetchAll = async (argPage,filterKey) => {
let { searchValue }=this.state
this.setState({
isSpin:true
@ -476,8 +479,8 @@ class studentsList extends Component{
// join_graduation_group
joinGraduationGroup = (graduation_group_id) => {
const courseId = this.props.match.params.coursesId
const courseId = this.props.match.params.coursesId
let { filterKey }=this.state
let url= `/courses/${courseId}/join_graduation_group.json`;
axios.post(url, {
course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }),
@ -485,7 +488,7 @@ class studentsList extends Component{
}).then((result)=>{
if(result.data.status==0){
this.props.showNotification('操作成功。')
this.fetchAll()
this.fetchAll(undefined,filterKey)
}
}).catch((error)=>{
console.log(error);
@ -493,6 +496,7 @@ class studentsList extends Component{
}
onInputSearchChange = (e) => {
let {filterKey}=this.state;
this.setState({
searchValue: e.target.value
})
@ -501,12 +505,12 @@ class studentsList extends Component{
clearTimeout(this.timeoutHandler)
}
this.timeoutHandler = setTimeout(() => {
this.fetchAll(1)
this.fetchAll(1,filterKey)
}, 1200)
}
onPressEnter = (e) => {
this.fetchAll(1)
this.fetchAll(1,this.state.filterKey)
}
@ -543,7 +547,7 @@ class studentsList extends Component{
changeRole = (member, role) => {
const courseId = this.props.match.params.coursesId
let {filterKey}=this.state;
let url= `/courses/${courseId}/change_course_teacher.json`;
axios.post(url, {
course_member_id: member.course_member_id
@ -556,7 +560,7 @@ class studentsList extends Component{
}).then((result)=>{
if(result.data.status==0){
this.props.showNotification('操作成功。')
this.fetchAll()
this.fetchAll(undefined,filterKey)
}
}).catch((error)=>{
console.log(error);
@ -572,9 +576,11 @@ class studentsList extends Component{
this.refs.addAdminModal.setVisible(true)
}
changeAdminSuccess = () => {
this.fetchAll()
let {filterKey}=this.state;
this.fetchAll(undefined,filterKey)
}
onDelete = (member) => {
let {filterKey}=this.state;
this.props.confirm({
content: `确认要将“${member.name}”从教师列表中移除吗?`,
onOk: () => {
@ -590,7 +596,7 @@ class studentsList extends Component{
// {"status":1,"message":"删除成功"}
this.props.showNotification('删除成功')
trigger('updatabanner')
this.fetchAll()
this.fetchAll(undefined,filterKey)
}
})
.catch(function (error) {
@ -615,12 +621,13 @@ class studentsList extends Component{
}
onTableChange = (pagination, filters, sorter) => {
let {filterKey}=this.state;
console.log('Various parameters', pagination, filters, sorter);
this.setState({
page: pagination.current,
sortedInfo: sorter,
}, () => {
this.fetchAll()
this.fetchAll(undefined,filterKey)
});
};
clearSelection = () => {
@ -633,7 +640,7 @@ class studentsList extends Component{
page:1,
isSpin:true
}, () => {
this.fetchAll();
this.fetchAll(undefined,e.key);
})
}
setGroupChooserModalVisible = (visible) => {
@ -755,9 +762,11 @@ class studentsList extends Component{
<div className="mt20 edu-back-white padding20 teacherList">
{ course_groups && !!course_groups.length && <CourseGroupChooserModal
{...this.state}
{...this.props}
props={{match: this.props.match, showNotification: this.props.showNotification}}
record={this.state.clickRecord}
fetchAll={this.fetchAll}
fetchAll={(e)=>this.fetchAll(e,this.state.filterKey)}
course_groups={course_groups}
visible={this.state.groupChooserModalVisible}
setVisible={this.setGroupChooserModalVisible}

Loading…
Cancel
Save