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

dev_hs
cxt 5 years ago
commit 9919730cb3

@ -451,7 +451,7 @@ class ApplicationController < ActionController::Base
cpu_limit = config.cpu_limit.presence || 1 cpu_limit = config.cpu_limit.presence || 1
cpu_request = config.lower_cpu_limit.presence || 0.1 cpu_request = config.lower_cpu_limit.presence || 0.1
memory_limit = config.memory_limit.presence || 1024 memory_limit = config.memory_limit.presence || 1024
request_limit = config.resource_limit.presence || 10 request_limit = config.request_limit.presence || 10
resource_limit = config.resource_limit.presence || 10000 resource_limit = config.resource_limit.presence || 10000
container << {:image => mirror.name, container << {:image => mirror.name,
:cpuLimit => cpu_limit, :cpuLimit => cpu_limit,

@ -348,7 +348,7 @@ class ExerciseQuestionsController < ApplicationController
#当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数.
if @exercise.exercise_status == Exercise::PUBLISHED if @exercise.exercise_status >= Exercise::PUBLISHED
ex_users_committed = @exercise.exercise_users.exercise_user_committed ex_users_committed = @exercise.exercise_users.exercise_user_committed
if ex_users_committed.size > 0 if ex_users_committed.size > 0
ex_users_committed.each do |ex_user| ex_users_committed.each do |ex_user|

@ -403,6 +403,12 @@ module ExercisesHelper
end end
user_answer_content = answer_choice_array.sort user_answer_content = answer_choice_array.sort
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
#TODO: 旧版多选题的标准答案是放在一个里面的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
if q.question_type == 1 && standard_answer.size == 1
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
if standard_answer.size > 0 if standard_answer.size > 0
q_score_1 = q.question_score q_score_1 = q.question_score

@ -0,0 +1,29 @@
class ChangeExercise1930Position < ActiveRecord::Migration[5.2]
def change
exs = Exercise.all.includes(:exercise_questions)
exs.each do |ex|
ex_questions = ex&.exercise_questions&.select(:id,:question_number,:exercise_id)&.order("question_number ASC") #试卷的位置迁移
if ex_questions.present?
ex_questions.each_with_index do |q,index|
puts index
q_num = index + 1
if q.question_number.to_i != q_num
q.update_attributes(question_number: q_num)
end
end
end
ex_q_bank = ex&.exercise_bank&.exercise_bank_questions&.select(:id,:question_number,:exercise_bank_id,:shixun_id)&.order("question_number ASC") #试卷的习题库位置迁移
if ex_q_bank.present?
ex_q_bank.each_with_index do |q,index|
puts index
q_num_1 = index + 1
if q.question_number.to_i != q_num_1
q.update_attributes(question_number: q_num_1)
end
end
end
end
end
end

@ -103,6 +103,13 @@ namespace :excellent_course_exercise do
end end
user_answer_content = answer_choice_array.sort user_answer_content = answer_choice_array.sort
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
#TODO: 旧版多选题的标准答案是放在一个里面的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
if q.question_type == 1 && standard_answer.size == 1
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
if standard_answer.size > 0 if standard_answer.size > 0
q_score_1 = q.question_score q_score_1 = q.question_score

@ -385,6 +385,12 @@ class CoursesBanner extends Component {
window.location.reload(); window.location.reload();
}; };
setHistoryFun=(url)=>{
this.props.history.replace(url)
}
render() { render() {
let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state; let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state;
@ -588,10 +594,10 @@ class CoursesBanner extends Component {
`} `}
</style> </style>
<Breadcrumb separator="|" className={"mt5"}> <Breadcrumb separator="|" className={"mt5"}>
<Breadcrumb.Item href={"/courses/"+this.props.match.params.coursesId+"/teachers"}> <Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}>
<span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10"}>教师</span> <span className={"mr10"}>{coursedata.teacher_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item href={"/courses/"+this.props.match.params.coursesId+"/students"}> <Breadcrumb.Item onClick={()=>this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}>
<span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span> <span className="color-grey-c font-16"><span className={"mr10 ml10"}>学生</span> <span className={"mr10"}>{coursedata.student_count}</span></span>
</Breadcrumb.Item> </Breadcrumb.Item>
<Breadcrumb.Item>{coursedata.credit===null?"": <Breadcrumb.Item>{coursedata.credit===null?"":

@ -880,7 +880,9 @@ class Coursesleftnav extends Component{
return( return(
<div key={key} > <div key={key} >
<a> <a>
<li title={item.name.length<7?"":item.name} onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<li onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}>
<Tooltip placement="bottom" title={item.name.length<7?"":item.name}>
<a onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> <a onClick={(e)=>this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{ {
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>: item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
@ -912,6 +914,7 @@ class Coursesleftnav extends Component{
</Popover>:""} </Popover>:""}
</a> </a>
</Tooltip>
</li> </li>
{/*下拉列表*/} {/*下拉列表*/}
@ -950,14 +953,15 @@ class Coursesleftnav extends Component{
> >
{/*"/courses/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/} {/*"/courses/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/}
<a className={"Draggablelichild"}> <a className={"Draggablelichild"}>
<li className="clearfix width93 Draggableli" key={index} onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)} <li className="clearfix width93 Draggableli" key={index} onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)}
key={index} key={index}
ref={provided.innerRef} ref={provided.innerRef}
{...provided.draggableProps} {...provided.draggableProps}
{...provided.dragHandleProps} {...provided.dragHandleProps}
title={iem.category_name.length<10?"":iem.category_name}
>
>
<Tooltip placement="bottom" title={iem.category_name.length<10?"":iem.category_name}>
<a className="fl pl46 pd0 Draggablelichild"> <a className="fl pl46 pd0 Draggablelichild">
<span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth155 task-hide Draggablelichild":"fl ml38 maxwidth155 task-hide Draggablelichild"}>{iem.category_name}</span> <span className={this.props.location.pathname===iem.second_category_url?"color-blue fl ml38 maxwidth155 task-hide Draggablelichild":"fl ml38 maxwidth155 task-hide Draggablelichild"}>{iem.category_name}</span>
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&twosandiantype===index&&iem.category_id!=0?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span> <span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14":item.type===twosandiantypes&&twosandiantype===index&&iem.category_id!=0?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue Draggablelichild font-14":"fr mr20 color999 Draggablelichild font-14"} >{iem.category_count===0?"":iem.category_count}</span>
@ -971,6 +975,7 @@ class Coursesleftnav extends Component{
</a> </a>
{provided.placeholder} {provided.placeholder}
</Tooltip>
</li> </li>
</a> </a>
</Tooltip> </Tooltip>
@ -994,10 +999,12 @@ class Coursesleftnav extends Component{
<div key={key}> <div key={key}>
{/*<Tooltip placement="bottom" title={"点击空白处展开二级菜单,点击模块名字跳转到对应模块"}>*/} {/*<Tooltip placement="bottom" title={"点击空白处展开二级菜单,点击模块名字跳转到对应模块"}>*/}
<a> <a>
<li className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} <li className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"}
onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)} onClick={(e)=>this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)}
title={item.name.length<7?"":item.name}
> >
<Tooltip placement="bottom" title={item.name.length<7?"":item.name}>
<a className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> <a className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}>
{ {
item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>: item.type==="announcement"?<i className={this.props.location.pathname===item.category_url?"color-blue iconfont icon-xiaoxi1 mr10 fl":"iconfont icon-xiaoxi1 mr10 fl"}></i>:
@ -1017,7 +1024,9 @@ class Coursesleftnav extends Component{
<span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span> <span className={this.props.location.pathname===item.category_url?"color-blue fr mr20 font-14":"fr mr20 color999 font-14"}>{item.task_count===0?"":item.task_count}</span>
</a> </a>
</Tooltip>
</li> </li>
</a> </a>
{/*</Tooltip>*/} {/*</Tooltip>*/}
@ -1036,7 +1045,8 @@ class Coursesleftnav extends Component{
} }
return( return(
<a> <a>
<li className="clearfix Draggableli" key={index} style={{ width: '244px'}} title={iem.category_name.length<10?"":iem.category_name}> <li className="clearfix Draggableli" key={index} style={{ width: '244px'}}>
<Tooltip placement="bottom" title={iem.category_name.length<10?"":iem.category_name}>
<a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} > <a className="fl pl46 pd0 Draggablelichild" onClick={(e)=>this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} >
{/*<span className="fl ml38 maxwidth155 task-hide">{iem.category_name}</span>*/} {/*<span className="fl ml38 maxwidth155 task-hide">{iem.category_name}</span>*/}
@ -1044,6 +1054,7 @@ class Coursesleftnav extends Component{
<span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14":twosandiantype===index&&item.type!="graduation"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14"}>{iem.category_count===0?"":iem.category_count}</span> <span className={twosandiantype===undefined?this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14":twosandiantype===index&&item.type!="graduation"?"none":this.props.location.pathname===iem.second_category_url?"fr mr20 color-blue font-14":"fr mr20 color999 font-14"}>{iem.category_count===0?"":iem.category_count}</span>
</a> </a>
</Tooltip>
</li> </li>
</a> </a>
) )

@ -276,7 +276,7 @@ class shixunAnswer extends Component{
} }
{ {
item.operation ? item.operation ?
<a className={isAdmin ? "color-blue mt5 fr":"color-blue"} target="_blank" href='javascript:void(0)' onClick={()=>this.scrollToAnchor(`${questionType.question_id}${index+1}`)}>查看</a> <a className={isAdmin ? "color-blue mt5 fr":"color-blue"} href='javascript:void(0)' onClick={()=>this.scrollToAnchor(`${questionType.question_id}${index+1}`)}>查看</a>
: :
<span className={isAdmin ? "color-grey-9 mt5 fr":"color-grey-9"} >--</span> <span className={isAdmin ? "color-grey-9 mt5 fr":"color-grey-9"} >--</span>
} }

@ -60,8 +60,8 @@ class ChooseEvaluateView extends Component {
</ul> </ul>
: item.result === true ? : item.result === true ?
<ul className=" font-14"> <ul className=" font-14">
<li><span className="-task-ces-info-left color-blue">正确选项</span><span>{item.actual_output}</span></li> <li><span className="-task-ces-info-left color-blue">正确选项</span><span>{item.standard_answer}</span></li>
<li><span className="-task-ces-info-left color-blue">你的选项</span><span className="color-orange">{item.standard_answer}</span></li> <li><span className="-task-ces-info-left color-blue">你的选项</span><span className="color-orange">{item.actual_output}</span></li>
</ul> </ul>
: :
<ul className=" font-14"> <ul className=" font-14">

Loading…
Cancel
Save