Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

sso
jingquan huang 5 years ago
commit a968fe1e4c

@ -169,6 +169,7 @@ module ShixunsHelper
source_class_name << source if source.present?
end
end
logger.info("####source_class_name: #{source_class_name}")
script = if script.include?("sourceClassName") && script.include?("challengeProgramName")
script.gsub(/challengeProgramNames=\(.*\)/,"challengeProgramNames=\(#{challenge_program_name.reject(&:blank?).join(" ")}\)").gsub(/sourceClassNames=\(.*\)/, "sourceClassNames=\(#{source_class_name.reject(&:blank?).join(" ")}\)")
else

@ -133,8 +133,10 @@ class HomeworksService
# 计算实训作品学生的效率分
def update_student_eff_score homework
if homework.work_efficiency && homework.max_efficiency != 0
max_efficiency = homework.student_works.where("compelete_status != 0").pluck(:efficiency).max
homework.update_column("max_efficiency", max_efficiency)
homework.student_works.where("compelete_status != 0").each do |student_work|
eff_score = student_work.efficiency / homework.max_efficiency * homework.eff_score
eff_score = student_work.efficiency / max_efficiency * homework.eff_score
student_work.eff_score = format("%.2f", eff_score)
student_work.late_penalty = student_work.work_status == 1 ? 0 : homework.late_penalty
unless student_work.ultimate_score
@ -333,7 +335,10 @@ class HomeworksService
work.compelete_status = myshixun_endtime < setting_time.end_time ? 2 : 3
# 如果作业的最大效率值有变更则更新所有作品的效率分
homework.update_column("max_efficiency", work.efficiency) if homework.work_efficiency && homework.max_efficiency < work.efficiency
if homework.work_efficiency && homework.max_efficiency < work.efficiency
homework.max_efficiency = work.efficiency
homework.save(validate: false)
end
else
work.compelete_status = 1 # 未通关
end

@ -76,7 +76,7 @@ class UpdateHomeworkPublishSettingService < ApplicationService
# 实训作业截止时间已过也可修改截止时间,其他作业暂不支持修改
if (homework.homework_type == "practice" || homework.end_time > Time.now) && homework.unified_setting
tip_exception("截止时间不能为空") if params[:end_time].blank?
tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= homework.publish_time
tip_exception("截止时间必须晚于发布时间") if params[:end_time].to_time <= homework.publish_time
# tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now
tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")}") if
course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day

@ -263,8 +263,13 @@ class PollDetailTabForthRules extends Component{
flag1=false;
}
else if(!arr.e_timeflag && moment(arr.end_time,dataformat) <= moment()){
arr.end_flag="截止时间不能早于当前时间"
flag1=false;
if(this.props.type==="Shixun"){
}else{
arr.end_flag="截止时间不能早于当前时间"
flag1=false;
}
}else if(!arr.e_timeflag && moment(arr.end_time,dataformat) <= moment(arr.publish_time,dataformat)){
arr.end_flag="截止时间不能早于发布时间"
flag1=false;
@ -314,8 +319,13 @@ class PollDetailTabForthRules extends Component{
flag2=false;
}
else if(moment(arr.end_time,dataformat) <= moment()){
arr.end_flag="截止时间不能早于当前时间"
flag2=false;
if(this.props.type==="Shixun"){
}else{
arr.end_flag="截止时间不能早于当前时间"
flag2=false;
}
}else if(moment(arr.end_time,dataformat) <= moment(arr.publish_time,dataformat)){
arr.end_flag="截止时间不能早于发布时间"
flag2=false;

@ -468,13 +468,13 @@ class Trainingjobsetting extends Component {
if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment()) {
//截止时间小于当前时间
this.scrollToAnchor("publishtimeid");
this.setState({
unit_e_tip: "截止时间不能早于当前时间",
p_flag: true,
borredss: "bor-reds",
})
return;
// this.scrollToAnchor("publishtimeid");
// this.setState({
// unit_e_tip: "截止时间不能早于当前时间",
// p_flag: true,
// borredss: "bor-reds",
// })
// return;
}
if (moment(this.state.end_time, "YYYY-MM-DD HH:mm") <= moment(this.state.publish_time, "YYYY-MM-DD HH:mm")) {
//截止时间小于发布时间
@ -787,6 +787,7 @@ class Trainingjobsetting extends Component {
.then((result) => {
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.getTrainingjobsetting(true);
this.props.showNotification(`更新成功`);
this.setState({
flagPageEditsbox: false,

Loading…
Cancel
Save