|
|
|
@ -42,6 +42,31 @@ class ChoquesEditor extends Component{
|
|
|
|
|
_standard_answers.push(item.standard_boolean)
|
|
|
|
|
_question_choices.push(item.choice_text)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const choicescomy=[];
|
|
|
|
|
try {
|
|
|
|
|
if(this.props.item_banksedit){
|
|
|
|
|
if(this.props.item_banksedit.choices){
|
|
|
|
|
|
|
|
|
|
this.props.item_banksedit.choices.forEach((item, index) => {
|
|
|
|
|
console.log("SingleEditor");
|
|
|
|
|
console.log(item);
|
|
|
|
|
choicescomy.push({
|
|
|
|
|
choice_text:item.choice_text,
|
|
|
|
|
standard_boolean:item.is_answer,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_question_choices = []
|
|
|
|
|
choicescomy.forEach((item, index) => {
|
|
|
|
|
_standard_answers.push(item.standard_boolean)
|
|
|
|
|
_question_choices.push(item.choice_text)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.state = {
|
|
|
|
|
question_choices: _question_choices || ['', '', '', ''],
|
|
|
|
@ -157,6 +182,34 @@ class ChoquesEditor extends Component{
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
this.setState({
|
|
|
|
|
item_banksedit:this.props.item_banksedit,
|
|
|
|
|
question_title:this.props.item_banksedit.name,
|
|
|
|
|
question_titles:this.props.item_banksedit.analysis,
|
|
|
|
|
mychoicess:this.props.item_banksedit.choices,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}catch (e) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
console.log("componentDidUpdate");
|
|
|
|
|
// console.log(prevProps);
|
|
|
|
|
// console.log(this.props.item_banksedit);
|
|
|
|
|
|
|
|
|
|
if(prevProps.item_banksedit !== this.props.item_banksedit) {
|
|
|
|
|
this.setState({
|
|
|
|
|
item_banksedit: this.props.item_banksedit,
|
|
|
|
|
question_title: this.props.item_banksedit.name,
|
|
|
|
|
question_titles: this.props.item_banksedit.analysis,
|
|
|
|
|
mychoicess: this.props.item_banksedit.choices,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onOptionClick = (index) => {
|
|
|
|
|
let standard_answers = this.state.standard_answers.slice(0)
|
|
|
|
|