diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake new file mode 100644 index 000000000..84f8afd34 --- /dev/null +++ b/lib/tasks/shixuns.rake @@ -0,0 +1,22 @@ +#coding=utf-8 + + +desc "纠正学生实训耗时不准的问题" + +namespace :shixuns do + task correct_the_shixun_cost_time: :environment do + puts "myshixun_id: #{ENV['myshixun_id']}" + if ENV['myshixun_id'].present? + myshixun = Myshixun.find(ENV['myshixun_id']) + myshixun.games.where(status: 2).each do |game| + puts "open_time: #{game.open_time.to_i}" + puts "end_time: #{game.end_time.to_i}" + puts "game_id: #{game.id}" + cost_time = game.end_time.to_i - game.open_time.to_i + puts "cost_time: #{cost_time}" + game.update_attributes!(cost_time: cost_time) + end + end + + end +end \ No newline at end of file diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 6deec5da1..2290f0dc5 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -3,8 +3,9 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do school_alls = School.includes(:courses, user_extensions: :user).all + proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| - Parallel.each(schools, in_processes: 5) do |school| + Parallel.each(schools, in_processes: proc_num) do |school| puts("school_id: #{school.id}") data = Schools::SchoolStatisticService.new(school) sta_all = StaAll.find_or_initialize_by(school_id: school.id) diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js index 8776b6a9e..ce5040821 100644 --- a/public/react/src/modules/testpaper/Intecomponents.js +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -282,6 +282,34 @@ class Intecomponents extends Component { } preservation = () => { + + let mylistcour=1; + try { + mylistcour=this.state.single_question_count+this.state.multiple_question_count+this.state.judgement_question_count+this.state.program_question_count + }catch (e) { + + } + if(mylistcour===0){ + this.props.showNotification(`没有题不能组卷`); + return; + } + + let arraycour=1; + try { + arraycour=this.Judquestio.Getdatas()[3].rbdxt+this.Judquestio.Getdatas()[4].rbdxtx+ this.Judquestio.Getdatas()[5].rbpdt+this.Judquestio.Getdatas()[6].rbbct + + }catch (e) { + + } + + if(arraycour===0){ + this.props.showNotification(`没有设置题型及数量不能组卷`); + return; + } + + + + if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return; diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index dccdbc5a7..8d3c85378 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - { - Periofters===true? -