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

dev_ec
杨树明 5 years ago
commit 9eb25f7cca

@ -6,15 +6,26 @@ class ChangeUserP02389416Exercise < ActiveRecord::Migration[5.2]
# 分数分别为2分2分5分2分2分2分2分2分 合计19分 # 分数分别为2分2分5分2分2分2分2分2分 合计19分
question_ids = [37411,37414,37417,37418,37419,37423,37424,37429] question_ids = [37411,37414,37417,37418,37419,37423,37424,37429]
choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828] choice_ids = [117788,117797,117806,117809,117811,117816,117818,117828]
question_scores = [2,2,5,2,2,2,2,2]
question_ids.each_with_index do |q, index| question_ids.each_with_index do |q, index|
ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index]) ex_exercise_user = ExerciseAnswer.where(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index])
if ex_exercise_user.exists?
ex_exercise_user.first.update_attribute(:score,question_scores[index])
else
ExerciseAnswer.create(user_id: 45442, exercise_question_id: q, exercise_choice_id: choice_ids[index], score: question_scores[index])
end
end end
ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first ex_user = ExerciseUser.where(user_id: 45442, exercise_id: 2561)&.first
if ex_user.present? if ex_user.present?
obj_score = ex_user.objective_score.to_i + 19 if ex_user.score > 65 || ex_user.objective_score > 65
total_score = ex_user.score.to_i + 19 ex_user.update_attributes(score: 65, objective_score: 65)
else
obj_score = ex_user.objective_score.to_i + 19
total_score = ex_user.score.to_i + 19
ex_user.update_attributes(score: total_score, objective_score: obj_score)
end
ex_user.update_attributes(score: total_score, objective_score: obj_score)
end end
puts "====> end_to_create user exercise_answer" puts "====> end_to_create user exercise_answer"

@ -334,24 +334,22 @@ class GraduationTasksSubmitedit extends Component{
} }
delecttask_status=(id,student_id)=>{ delecttask_status=(id)=>{
let newid=id===undefined||id===null?student_id:id;
let{selectmemberslist,task_status}=this.state; let{selectmemberslist,task_status}=this.state;
let newlist=task_status; let newlist=task_status;
let selects=selectmemberslist; let selects=selectmemberslist;
for(var i=0; i<newlist.length; i++){ for(var i=0; i<newlist.length; i++){
if(newlist[i]===newid){ if(newlist[i]===id){
newlist.splice(i,1) newlist.splice(i,1)
} }
} }
for(var z=0; z<selects.length; z++){ for(var z=0; z<selects.length; z++){
if(selects[z].user_id===newid){ if(selects[z].user_id===id){
selects.splice(z,1) selects.splice(z,1)
}else if(selects[z].student_id===newid){ }
selects.splice(z,1)
}
} }
console.log(newlist) console.log(newlist)
console.log(selects) console.log(selects)
@ -384,10 +382,6 @@ class GraduationTasksSubmitedit extends Component{
let userids=[]; let userids=[];
for(var list of selectmemberslist){ for(var list of selectmemberslist){
if(list.student_id!=undefined&&list.student_id!=null){
userids.push(list.student_id)
}
if(list.user_id!=undefined&&list.user_id!=null){ if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id) userids.push(list.user_id)
} }
@ -812,7 +806,7 @@ class GraduationTasksSubmitedit extends Component{
{key > 0 ? {key > 0 ?
<div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"} <div className={"fr ml20"}><i className={"iconfont icon-shanchudiao fl color-grey-9"}
style={{marginTop: '-4px'}} style={{marginTop: '-4px'}}
onClick={() => this.delecttask_status(item.user_id,item.student_id)}></i> onClick={() => this.delecttask_status(item.user_id)}></i>
</div> : ""} </div> : ""}
<div className={"both"}></div> <div className={"both"}></div>
</div> </div>

Loading…
Cancel
Save