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

dev_jupyter
杨树林 5 years ago
commit 8c552dea15

@ -1,6 +1,8 @@
class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2] class ModifyCourseGroupForCourses < ActiveRecord::Migration[5.2]
def change 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 ActiveRecord::Base.transaction do
groups.each do |g| groups.each do |g|
CourseGroup.where(name: g.name).where.not(id: g.id).each do |cg| 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.attachment_group_settings.update_all(course_group_id: g.id)
cg.homework_group_reviews.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.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! cg.destroy!
end end
end end

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

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

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

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

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

@ -129,10 +129,14 @@ class Sendresource extends Component{
let {fileList,description,is_public,datatime,Radiovalue} =this.state; let {fileList,description,is_public,datatime,Radiovalue} =this.state;
let newfileList=[]; 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){ if(newfileList.length===0){
this.setState({ this.setState({
newfileListtype:true newfileListtype:true

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

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

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

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

Loading…
Cancel
Save