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

dev_jupyter
cxt 5 years ago
commit 48ab836b54

@ -1,6 +1,8 @@
class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2]
def change
groups = CourseGroup.where(course_id:3429).order("created_at desc").group(:name)
course_ids = [1135, 1208, 1309, 1528, 1563, 1800, 2025, 2086, 2346, 2915, 2917, 2919, 2954, 3064, 3136, 3387, 3423,
3429, 3467, 3651, 3704, 3732]
groups = CourseGroup.where(course_id: course_ids).order("created_at desc").group(:name)
ActiveRecord::Base.transaction do
groups.each do |g|
CourseGroup.where(name: g.name).where.not(id: g.id).each do |cg|
@ -11,7 +13,7 @@ class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2]
cg.attachment_group_settings.update_all(course_group_id: g.id)
cg.homework_group_reviews.update_all(course_group_id: g.id)
cg.homework_group_settings.update_all(course_group_id: g.id)
cg.teacher_course_groups.update_all(course_group_id: g.id)
#cg.teacher_course_groups.update_all(course_group_id: g.id)
cg.destroy!
end
end

@ -138,13 +138,14 @@ class CommonWorkPost extends Component{
let {fileList,selectmemberslist,workslist, memberNumMin, memberNumMax}=this.state;
let userids=[];
if(selectmemberslist!=undefined&&selectmemberslist.length>0) {
for (var list of selectmemberslist) {
for(var list of selectmemberslist){
if (list.user_id != undefined && list.user_id != null) {
userids.push(list.user_id)
}
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
}
const isGroup = this.props.isGroup()
if(!isGroup){
@ -152,11 +153,11 @@ class CommonWorkPost extends Component{
}
let listid=[];
for(var list of fileList){
listid.push(list.id || list.response.id)
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
listid.push(list.id || list.response.id)
}
}
e.preventDefault();
if( true ){
this.props.form.validateFields((err, values) => {

@ -96,6 +96,7 @@ class PublishRightnow extends Component{
}
homeworkstartend=(arg_group_ids,endtime)=>{
debugger
if (this.usingCheckBeforePost && this.props.checkBeforePost) {
const goOn = this.props.checkBeforePost();
if (!goOn) {
@ -103,6 +104,7 @@ class PublishRightnow extends Component{
return;
}
}
debugger
const isPublish = this.props.isPublish;
let group_ids = arg_group_ids
if (this.usingCheckBeforePost) {
@ -110,13 +112,16 @@ class PublishRightnow extends Component{
return item.id
})
}
if (this.state.course_groups.length && (!group_ids || group_ids.length == 0)) {
this.props.showNotification('请至少选择一个分班');
return;
debugger
if(this.state.course_groups.length>0){
if (this.state.course_groups.length && (!group_ids || group_ids&&group_ids.length == 0)) {
this.props.showNotification('请至少选择一个分班');
return;
}
}
let data={}
if(arg_group_ids.length===0){
if(arg_group_ids&&arg_group_ids.length===0){
data = {
homework_ids: this.props.checkBoxValues,
end_time: endtime==="Invalid date"?undefined:endtime,

@ -125,10 +125,11 @@ class AccessoryModal extends Component{
let {fileList,description} =this.state;
let newfileList=[];
for(var list of fileList){
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
newfileList.push(list.response.id)
}
}
if (newfileList.length == 0) {
// this.props.showNotification('请先上传附件')
if(this.props.modalname === "补交附件"){
@ -194,8 +195,10 @@ class AccessoryModal extends Component{
let {fileList,description} =this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
newfileList.push(list.response.id)
}
}
let url= this.props.reviseAttachmentUrl || "/graduation_works/"+id+"/revise_attachment.json"
axios.post(url,{

@ -127,8 +127,10 @@ class AccessoryModal2 extends Component{
// debugger
let {fileList,description} =this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
newfileList.push(list.response.id)
}
}
this.props.Saves && this.props.Saves(newfileList, description)
return;

@ -108,10 +108,13 @@ class Selectsetting extends Component{
let {fileList,is_public,description,datatime,Radiovalue}=this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
if(fileList!=undefined&&fileList.length>0){
for(var list of fileList){
newfileList.push(list.response.id)
}
}
if(this.state.Radiovalue===1){
if(datatime===undefined||datatime===null||datatime=== ""){
this.setState({

@ -129,10 +129,14 @@ class Sendresource extends Component{
let {fileList,description,is_public,datatime,Radiovalue} =this.state;
let newfileList=[];
for(var list of fileList){
newfileList.push(list.response.id)
if(fileList!=undefined&&fileList.length>0){
for(var list of fileList){
newfileList.push(list.response.id)
}
}
if(newfileList.length===0){
this.setState({
newfileListtype:true

@ -41,7 +41,7 @@ class GraduationTasksSubmitedit extends Component{
componentDidMount(){
this.props.form.validateFields();
let workId=this.props.match.params.work_Id;
let url = "/graduation_works/"+workId+"/edit.json";
@ -367,7 +367,6 @@ class GraduationTasksSubmitedit extends Component{
let {fileList,selectmemberslist,workslist}=this.state;
this.Commoninterface(fileList,selectmemberslist,workslist);
// setTimeout(function () {
// GraduationTasksnewtype=true
@ -380,27 +379,37 @@ class GraduationTasksSubmitedit extends Component{
let workId=this.props.match.params.work_Id;
let userids=[];
// for(var list of selectmemberslist){
// if(list.user_id!=undefined&&list.user_id!=null){
// userids.push(list.user_id)
// }
// }
if(selectmemberslist!=undefined&&selectmemberslist.length>0){
selectmemberslist.map((list,key)=>{
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
})
}
for(var list of selectmemberslist){
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
}
let listid=[];
for(var list of fileList){
listid.push(list.response == undefined ? list.id : list.response.id)
// for(var list of fileList){
// listid.push(list.response == undefined ? list.id : list.response.id)
// }
if(fileList!=undefined&&fileList.length>0){
fileList.map((list,key)=>{
listid.push(list.response == undefined ? list.id : list.response.id)
})
}
console.log(userids)
this.props.form.validateFields((err, values) => {
this.props.form.validateFields((err, values) => {
// console.log(fileList);
if(values.description===undefined||values.description===""){
this.scrollToAnchor("valuestypes");
// debugger
return
}
@ -593,7 +602,7 @@ class GraduationTasksSubmitedit extends Component{
{description&&description?
<div>
{/*<Form onSubmit={this.handleSubmit} >*/}
<Form>
<div className="stud-class-set pd20 coursenavbox edu-back-white" id={"valuestypes"}>
<style>{`
.uploadBtn.ant-btn {
@ -831,13 +840,13 @@ class GraduationTasksSubmitedit extends Component{
<Form.Item>
{/*<Form.Item></Form.Item>*/}
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>
{/*</Form>*/}
</Form>
</div>
:""}

@ -382,24 +382,27 @@ class GraduationTasksSubmitnew extends Component{
Commoninterface = (fileList,selectmemberslist,workslist)=>{
// debugger
let userids=[];
if(selectmemberslist!=undefined&&selectmemberslist.length>0){
for(var list of selectmemberslist){
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
for(var list of selectmemberslist){
debugger
if(list.user_id!=undefined&&list.user_id!=null){
userids.push(list.user_id)
}
}
if(workslist.task_type===1){
userids=undefined
}
let listid=[];
for(var list of fileList){
listid.push(list.response.id)
if(fileList!=undefined&&fileList.length>0){
for(var list of fileList){
listid.push(list.response.id)
}
}
// if( GraduationTasksnewtype===true){
this.props.form.validateFields((err, values) => {
@ -836,7 +839,7 @@ render(){
<Form.Item>
<div className="clearfix mt30 mb30">
<Button type="primary" htmlType="submit" onClick={()=>this.handleSubmit()} className="defalutSubmitbtn fl mr20">提交</Button>
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a onClick={this.goback} className="defalutCancelbtn fl">取消</a>
</div>
</Form.Item>

@ -205,13 +205,15 @@ class GraduationTasksedit extends Component{
Commoninterface=(fileList)=>{
let listid=[]
let graduation_id=this.state.data.graduation_id;
for(var list of fileList){
if(list.response!=undefined){
listid.push(list.response.id)
}else{
listid.push(list.uid)
}
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
if (list.response != undefined) {
listid.push(list.response.id)
} else {
listid.push(list.uid)
}
}
}
// console.log(listid)

@ -35,10 +35,11 @@ class CreateGroupByImportModal extends Component{
return;
}
let newfileList=[];
for(var list of fileList){
if(fileList!=undefined&&fileList.length>0) {
for (var list of fileList) {
newfileList.push(list.response.id)
}
}
axios.post(url, {
attachment_ids: newfileList
})

@ -66,6 +66,9 @@ class Paperreview_single extends Component {
let {questions,totalscore,total,items} = this.state;
let {objectsingle} =this.props;
// //console.log(params);
const objectsingleid=objectsingle.id;
const objectsinglescore=`${objectsingle.score}分)`;
return (
<div className="w100s borderwdswuh mt25 mb20 pd20 " style={{
minHeight: "114px",
@ -74,9 +77,9 @@ class Paperreview_single extends Component {
{/*顶部*/}
<div className="w100s sortinxdirection ">
<div className=" sortinxdirection ">
<p className="cretitlecolrlis lh28">{objectsingle.id}</p><p className="cretitlecolrlisobj lh28">{objectsingle.score}</p>
</div>
{/*<div className=" sortinxdirection ">*/}
{/* <p className="cretitlecolrlis lh28">{objectsingleid}</p>、<p className="cretitlecolrlisobj lh28">{objectsinglescore}分)</p>*/}
{/*</div>*/}
<style>
{
`
@ -95,38 +98,57 @@ class Paperreview_single extends Component {
`
}
</style>
<div className=" lh28 listjihetixingstit markdown-body cretitlecolrlist" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle&&objectsingle.name).replace(/▁/g, "▁▁▁")}}>
<div className=" lh28 listjihetixingstit markdown-body cretitlecolrlist" style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingleid+objectsinglescore+objectsingle.name).replace(/▁/g, "▁▁▁")}}>
</div>
</div>
{/*内容*/}
<div className="w100s sortinxdirection">
<p className="w100s listjihetixingstits sortinxdirection ">
{
objectsingle.item_type==="JUDGMENT"?
objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index===1? "sortinxdirection ml10":"sortinxdirection " } >
<Radio checked={object.is_answer}>
{object.choice_text}
</Radio>
</p>
)
})
<p className="w100s listjihetixingstits sortinxdirection ">
{
objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index===1? "sortinxdirection ml10":"sortinxdirection " } >
<Radio checked={object.is_answer}>
{object.choice_text}
</Radio>
</p>
)
})
}
</p>
:
objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => {
return (
<p className="sortinxdirection " >
{tagArray[index]}
<p style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(object.choice_text).replace(/▁/g, "▁▁▁")}}></p>
objectsingle.item_type==="PROGRAM"?
<p className="w100s listjihetixingstitssy sortinxdirection ">
<p className={"sortinxdirection mt15"} >
<p style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(objectsingle.program_attr.description).replace(/▁/g, "▁▁▁")}}></p>
</p>
)
})
</p>
:
<p className="w100s listjihetixingstits verticallayout ">
{
objectsingle === undefined ||objectsingle === null? "" : objectsingle.choices.map((object, index) => {
return (
<p className={index===0?"sortinxdirection":"sortinxdirection mt15"} >
{tagArray[index]}
<p style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML(object.choice_text).replace(/▁/g, "▁▁▁")}}></p>
</p>
)
})
}
</p>
}
</p>
</div>
</div>
</div>
)
}

@ -23,7 +23,8 @@ class Contentpart extends Component {
super(props);
this.state = {
page:1,
chakanjiexibool:false,
chakanjiexiboolindex:"无",
}
}
//初始化
@ -32,7 +33,18 @@ class Contentpart extends Component {
}
chakanjiexibool=(index)=>{
debugger
if(this.state.chakanjiexiboolindex===index){
this.setState({
chakanjiexiboolindex:"无",
})
return
}
this.setState({
chakanjiexiboolindex:index,
})
}
render() {
let {page}=this.state;
@ -203,7 +215,9 @@ class Contentpart extends Component {
: this.props.Contentdata.items.map((object, index) => {
return (
<Listjihe {...this.state} {...this.props}
listjihe={index}
chakanjiexibool={(keindex)=>this.chakanjiexibool(keindex)}
listjihe={index+1}
keindex={index}
items={object}
key={index}
getitem_basketss={(id)=>this.props.getitem_basketss(id)}

@ -22,7 +22,6 @@ class Listjihe extends Component {
page:1,
name:"单选题",
nd:"简单",
chakanjiexibool:false,
}
}
//初始化
@ -31,18 +30,6 @@ class Listjihe extends Component {
}
chakanjiexibool=()=>{
if(this.state.chakanjiexibool===true){
this.setState({
chakanjiexibool:false
})
}else{
this.setState({
chakanjiexibool:true
})
}
}
//选用
Selectingpracticaltraining=(id)=>{
let data={
@ -61,18 +48,41 @@ class Listjihe extends Component {
render() {
let {page,name,nd,chakanjiexibool}=this.state;
let {defaultActiveKey,items,listjihe}=this.props;
let {page,name,nd}=this.state;
let {defaultActiveKey,items,listjihe,chakanjiexiboolindex,keindex}=this.props;
// 编程答案
var rightkey=null
if(items){
if(items.item_type){
if(items.item_type==="PROGRAM"){
}else{
if(items.choices){
if(items.choices.length>0){
var arr= items.choices;
for(let data of arr) {
if(data.is_answer===true){
rightkey=data.choice_text;
break;
}
}
}
}
}
}
}
////console.log("Listjihe");
////console.log(this.props);
return (
<div className={chakanjiexibool===true?"w100s borderwds283 pd20 mb20":"w100s borderwds pd20 mb20"}>
<div className={chakanjiexiboolindex===keindex?"w100s borderwds283 pd20 mb20":"w100s borderwds pd20 mb20"}>
{/*顶部*/}
<div className="w100s sortinxdirection">
<div className="listjihetixingstitsy">
{
this.props.listjihe+1
this.props.listjihe
}
</div>
<div className="listjihetixingstitsy">
@ -118,6 +128,8 @@ class Listjihe extends Component {
</p>
}
</div>
<div className="w100s sortinxdirection mt10">
<p className="listjihetixing">难度<span >{items.difficulty===1?"简单":items.difficulty===2?"适中":items.difficulty===3?"困难":""}</span></p>
<p className="ml30 listjihetixing">题型<span >{items.item_type==="SINGLE"?"单选题":items.item_type==="MULTIPLE"?"多选题":items.item_type==="JUDGMENT"?"判断题":items.item_type==="PROGRAM"?"编程题":""}</span></p>
@ -174,7 +186,7 @@ class Listjihe extends Component {
items.item_type==="PROGRAM"?
""
:
<p className="viewparsings xiaoshou mr25" onClick={()=>this.chakanjiexibool()}>
<p className="viewparsings xiaoshou mr25" onClick={()=>this.props.chakanjiexibool(keindex)}>
<i className="iconfont icon-jiexi font-17 lg ml7 lh30 icontianjiadaohangcolors mr5"></i>
查看解析</p>
}
@ -184,13 +196,13 @@ class Listjihe extends Component {
</div>
</div>
{
chakanjiexibool===true?<div>
chakanjiexiboolindex===keindex?<div>
<div className="w100s questiontypeheng mt23">
</div>
<div className=" sortinxdirection mt15 yldxtit" >
<p className=" testfondex yldxtit"
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("答案:"+items.analysis).replace(/▁/g, "▁▁▁")}}
style={{wordBreak: "break-word"}} dangerouslySetInnerHTML={{__html: markdownToHTML("答案:"+rightkey).replace(/▁/g, "▁▁▁")}}
>
</p>
</div>

Loading…
Cancel
Save