|
|
@ -84,17 +84,21 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
// dispatch({type:'CHANGE_QUESTION_ORDER', payload : data})
|
|
|
|
// dispatch({type:'CHANGE_QUESTION_ORDER', payload : data})
|
|
|
|
// console.log(data)
|
|
|
|
// console.log(data)
|
|
|
|
|
|
|
|
|
|
|
|
const aaa = [...addExamState.questions]; |
|
|
|
const aaa = [...addExamState.courses.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions]; |
|
|
|
const [removed] = aaa.splice(aaa.indexOf(itm => itm.questionId == source.index), 1); |
|
|
|
const [removed] = aaa.splice( source.index, 1); |
|
|
|
|
|
|
|
|
|
|
|
aaa.splice(aaa.indexOf(itm=> itm.questionId == destination.index), 0, removed); |
|
|
|
aaa.splice(destination.index, 0, removed); |
|
|
|
dispatch({type: 'CHANGE_QUESTION_ORDER', payload: aaa}) |
|
|
|
dispatch({type: 'CHANGE_QUESTION_ORDER', payload: aaa}) |
|
|
|
console.log(result) |
|
|
|
console.log(result) |
|
|
|
|
|
|
|
console.log(source.index) |
|
|
|
|
|
|
|
console.log(destination.index) |
|
|
|
|
|
|
|
console.log(aaa) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(addExamState.courses.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(addExamState.courses.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions) |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
{ |
|
|
|
{ |
|
|
@ -217,7 +221,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
{ |
|
|
|
{ |
|
|
|
console.log(result) |
|
|
|
console.log(result) |
|
|
|
if(result.source.droppableId == 'Choosed_Questions_Form_Bank'){ |
|
|
|
if(result.source.droppableId == 'Choosed_Questions_Form_Bank'){ |
|
|
|
seChoosedQuestion(addExamState.courses.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions?.find(itm => itm.questionId == result.source.index)) |
|
|
|
seChoosedQuestion(addExamState.courses.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions[result.source.index]) |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
seChoosedQuestion(addExamState.questionBank.find(itm => itm.questionId == result.source.index)) |
|
|
|
seChoosedQuestion(addExamState.questionBank.find(itm => itm.questionId == result.source.index)) |
|
|
|
} |
|
|
|
} |
|
|
@ -239,7 +243,7 @@ const AddQuestionsFromBank = ({ grades, addExamState, dispatch, stepClick, backS |
|
|
|
{ |
|
|
|
{ |
|
|
|
addExamState.courses?.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions?.map( |
|
|
|
addExamState.courses?.filter(itm => itm.id == selectedCourse.id)[0]?.selectedQuestions?.map( |
|
|
|
(item, index) => ( |
|
|
|
(item, index) => ( |
|
|
|
<Draggable draggableId={`_${item.questionId}`} index={item.questionId} key={`CHOOSED_QUESTIONS_${index}`}> |
|
|
|
<Draggable draggableId={`_${item.questionId}`} index={index} key={`CHOOSED_QUESTIONS_${item.questionId}`}> |
|
|
|
{(provided) => ( |
|
|
|
{(provided) => ( |
|
|
|
<div {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}> |
|
|
|
<div {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}> |
|
|
|
<Question data={item} /> |
|
|
|
<Question data={item} /> |
|
|
|