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

dev_local_2
hjm 6 years ago
commit 35f5f6b067

@ -497,7 +497,38 @@ class ExerciseQuestionsController < ApplicationController
ex_obj_score = @exercise_current_user.objective_score #全部客观题得分 ex_obj_score = @exercise_current_user.objective_score #全部客观题得分
ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分 ex_subj_score = @exercise_current_user.subjective_score < 0.0 ? 0.0 : @exercise_current_user.subjective_score #全部主观题得分
ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分 ex_answers = @exercise_question.exercise_answers.search_answer_users("user_id",@user_id) #当前用户答案的得分
if @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分, if @exercise_question.question_type == Exercise::MULTIPLE
if ex_answers.present? #学生有回答时 取学生的答题得分否则0分
answer_choice_array = []
ex_answers.each do |a|
answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置
end
user_answer_content = answer_choice_array.sort
standard_answer = @exercise_question.exercise_standard_answers.pluck(:exercise_choice_id).sort
if standard_answer.size == 1 # 老数据需要判断学生答题是否正确, 正确取原题得分否则是0分
standard_answer = standard_answer.first.to_s.split("").map(&:to_i).sort
if user_answer_content == standard_answer
ex_answer_old = @exercise_question.question_score
else
ex_answer_old = 0
end
else # 新多选题只需取第一条答题记录的得分
ex_answer_old = ex_answers.first.score > 0 ? ex_answers.first.score : 0
end
else
ex_answer_old = 0
end
new_obj_score = ex_obj_score - ex_answer_old + @c_score
total_scores = new_obj_score + ex_subj_score
ex_scores = {
:objective_score => new_obj_score,
:score => total_scores
}
@exercise_current_user.update_attributes(ex_scores)
ex_answers.update_all(:score => @c_score) #所有的正确选项需重新更新
elsif @exercise_question.question_type == Exercise::COMPLETION #当为填空题,更新问题的总分,
ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和 ex_answer_old = ex_answers.score_reviewed.pluck(:score).sum #每一关的得分总和
each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数 each_right_score = (@c_score / ex_answers.count.to_f) #调分后,平均每关的分数
new_obj_score = ex_obj_score - ex_answer_old + @c_score new_obj_score = ex_obj_score - ex_answer_old + @c_score
@ -579,7 +610,7 @@ class ExerciseQuestionsController < ApplicationController
end end
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("没有权限") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -703,8 +734,8 @@ class ExerciseQuestionsController < ApplicationController
normal_status(-1,"用户不存在!") normal_status(-1,"用户不存在!")
elsif @c_score.blank? elsif @c_score.blank?
normal_status(-1,"分数不能为空!") normal_status(-1,"分数不能为空!")
elsif @exercise_question.question_type <= Exercise::JUDGMENT elsif @exercise_question.question_type == Exercise::SINGLE || @exercise_question.question_type == Exercise::JUDGMENT
normal_status(-1,"题/判断题不能调分!") normal_status(-1,"选题/判断题不能调分!")
elsif params[:comment].present? && params[:comment].length > 100 elsif params[:comment].present? && params[:comment].length > 100
normal_status(-1,"评语不能超过100个字符!") normal_status(-1,"评语不能超过100个字符!")
else else

Binary file not shown.

@ -305,7 +305,7 @@ class CoursesIndex extends Component{
//Do your stuff here //Do your stuff here
}); });
} }
//更新左边课堂导航
updataleftNav=()=>{ updataleftNav=()=>{
let query=this.props.location.pathname let query=this.props.location.pathname
let {isaloadtype}=this.state; let {isaloadtype}=this.state;

@ -29,12 +29,14 @@ class Elearning extends Component{
userlogin:"", userlogin:"",
isRender:false, isRender:false,
subject_id:0, subject_id:0,
myupdataleftNavs:this.myupdataleftNav
} }
} }
componentDidMount() { componentDidMount() {
// 记得删除退出课堂 // 记得删除退出课堂
// console.log("获取到数据"); // console.log("在线学习");
// console.log("获取到数据");
// console.log(this.props); // console.log(this.props);
this.getdata(); this.getdata();
} }
@ -289,6 +291,9 @@ class Elearning extends Component{
}) })
}; };
myupdataleftNav=()=>{
this.props.updataleftNavfun();
}
render(){ render(){
console.log("Elearning++++++++"); console.log("Elearning++++++++");
// console.log(this.props.Chapterupdate); // console.log(this.props.Chapterupdate);
@ -397,7 +402,7 @@ class Elearning extends Component{
<div> <div>
{/*开始学习*/} {/*开始学习*/}
<YslDetailCards {...this.state} {...this.props} Startlearningtwo={()=>this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()} getPathCardsList={()=>this.getdata()}></YslDetailCards> <YslDetailCards {...this.state} {...this.props} Startlearningtwo={()=>this.Startlearningtwo()} Myreload={()=>this.Myreload()} Tojoinclass={()=>this.Tojoinclass()} getPathCardsList={()=>this.getdata()} ></YslDetailCards>
</div> </div>

@ -210,7 +210,7 @@ class YslDetailCards extends Component{
//取消 //确认
updatapathCardsedit=()=>{ updatapathCardsedit=()=>{
this.setState({ this.setState({
idsum:undefined, idsum:undefined,
@ -219,9 +219,10 @@ class YslDetailCards extends Component{
editbuttomtypeadd:false editbuttomtypeadd:false
}) })
this.props.getPathCardsList(); this.props.getPathCardsList();
this.props.myupdataleftNavs();
// this.props.updatadetailInfoLists(); // this.props.updatadetailInfoLists();
}; };
//确认 //取消
editeditbuttomtypecanle=()=>{ editeditbuttomtypecanle=()=>{
this.setState({ this.setState({
editbuttomtype:true, editbuttomtype:true,
@ -300,6 +301,7 @@ class YslDetailCards extends Component{
this.updatapathCardsedit() this.updatapathCardsedit()
this.props.showNotification(`删除成功`); this.props.showNotification(`删除成功`);
this.props.myupdataleftNavs();
}else { }else {
this.props.showNotification(`删除失败`); this.props.showNotification(`删除失败`);
} }

@ -1037,7 +1037,7 @@ class ShixunHomework extends Component{
{/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/} {/*<span className="font-18 fl color-dark-21">{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}</span>*/}
<span className="font-18 fl color-dark-21">实训作业</span> <span className="font-18 fl color-dark-21">实训作业</span>
<li className="fr"> <li className="fr">
{datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isClassManagement()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? {datas===undefined?"":datas.homeworks && datas.homeworks.length>1?this.props.isAdminOrCreator()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null?
<span> <span>
<WordsBtn style="blue" className={"mr30 font-16"}> <WordsBtn style="blue" className={"mr30 font-16"}>
<Link className="color4CACFF" to={`/courses/${this.props.match.params.coursesId}/ordering/shixun_homework/${main_id&&main_id}`}>调整排序</Link> <Link className="color4CACFF" to={`/courses/${this.props.match.params.coursesId}/ordering/shixun_homework/${main_id&&main_id}`}>调整排序</Link>

@ -123,10 +123,11 @@ class DetailCardsEditAndAdd extends Component{
//点击新建阶段 //点击新建阶段
addStage=()=>{ addStage=()=>{
this.props.editeditbuttomtypes();
this.setState({ this.setState({
editPanel:true editPanel:true
}) })
this.props.editeditbuttomtypes();
} }
//取消新建阶段 //取消新建阶段
@ -294,13 +295,12 @@ class DetailCardsEditAndAdd extends Component{
shixun_id:shixuns_listeditlist shixun_id:shixuns_listeditlist
}).then((response) => { }).then((response) => {
// window.location.href = "/paths/" + response.data.subject_id // window.location.href = "/paths/" + response.data.subject_id
this.props.getPathCardsLists();
this.cancelAddState(); this.cancelAddState();
this.setState({ this.setState({
stage_nametype:false, stage_nametype:false,
descriptiontype:false descriptiontype:false
}) })
this.props.getPathCardsLists();
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });

@ -202,48 +202,40 @@ export function TPMIndexHOC(WrappedComponent) {
NORMAL = 6 # 普通用户 NORMAL = 6 # 普通用户
Anonymous = 7 # 普未登录 Anonymous = 7 # 普未登录
*/ */
//超管 //超管0
isSuperAdmin = () => { isSuperAdmin = () => {
// return false // return false
return this.state.coursedata&&this.state.coursedata.course_identity === 0 return this.state.coursedata&&this.state.coursedata.course_identity === 0
} }
// 课堂管理等 //超管、运维0-1
isClassManagement = () => { isClassManagement = () => {
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity < 2 return this.state.coursedata&&this.state.coursedata.course_identity < 2
} }
//老师等 //超管、运维、课堂管理0-2
isAdminOrCreator = () => { isAdminOrCreator = () => {
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity < 3 return this.state.coursedata&&this.state.coursedata.course_identity < 3
} }
// 助教等 //超管、运维、课堂管理、老师0-3
isAdminOrTeacher = () => { isAdminOrTeacher = () => {
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity < 4 return this.state.coursedata&&this.state.coursedata.course_identity < 4
} }
// 老师、管理员等 // 超管、运维、课堂管理、老师、助教0-4
isAdmin = () => { isAdmin = () => {
// return false
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity < 5 return this.state.coursedata&&this.state.coursedata.course_identity < 5
} }
// 学生 // 学生5
isStudent = () => { isStudent = () => {
// return true
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity === 5 return this.state.coursedata&&this.state.coursedata.course_identity === 5
} }
// 超管、运维、课堂管理、老师、助教、学生0-5
isAdminOrStudent = () => { isAdminOrStudent = () => {
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity <= 5 return this.state.coursedata&&this.state.coursedata.course_identity <= 5
} }
// 非课堂成员 // 游客未登录/非课堂成员6>
isNotMember = () => { isNotMember = () => {
// return this.state.coursedata&&this.state.coursedata.course_identity >= 0 &&
return this.state.coursedata&&this.state.coursedata.course_identity >= 6 return this.state.coursedata&&this.state.coursedata.course_identity >= 6
} }
//课堂是否已结束
isCourseEnd = () => { isCourseEnd = () => {
return this.state.current_user ? this.state.current_user.course_is_end : false return this.state.current_user ? this.state.current_user.course_is_end : false
} }

Loading…
Cancel
Save