Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions ClientSide/src/Application/Nadia.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ export default class Nadia {
})
},

editAnswer:(question, callback)=>{
Bus.command('inference/editAnswer', {question:question}).done((res)=>{

callback(res);
})
},

updateHistory:(ruleName, callback)=>{
Bus.command('rule/updateHistory', {ruleName: ruleName, ruleText: ''}).done((res)=>{
if(res.update == 'done'){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,35 +166,6 @@ class RuleExecutionPage extends React.Component {
if(res.hasMoreQuestion == 'true'){
this._getNextQuestion();
}
else{
let goalRuleData = {goalRuleName: res.goalRuleName, goalRuleValue: res.goalRuleValue, goalRuleType: res.goalRuleType};
let goalRuleComponent = <QuestionItem key={res.goalRuleName} isGoalRule goalRuleData = {goalRuleData} />
let tempQuestionnaire = Clone(this.state.questionnaire);
tempQuestionnaire.unshift(goalRuleComponent);

this.setState(
{
hasMoreQuestion: !this.state.hasMoreQuestion,
goalRule: goalRuleData,
questionnaire: tempQuestionnaire,
}
);
}
});
}

_onEditAnswer=(question)=>{
this.setState({questionnaire:[],questions:[]});
Nadia.command.editAnswer(question,(res)=>{
if(res.hasMoreQuestion == 'true'){
res.workingMemory.map((item)=>{
let answeredQuestion = <AnsweredQuestionItem key={item.question} questionData = {item} editAnswer={this._onEditAnswer}/>;
let tempQuestionnaire = Clone(this.state.questionnaire);
tempQuestionnaire.unshift(answeredQuestion);
});
this.setState({questionnaire: tempQuestionnaire});
this._getNextQuestion();
}
else{
let goalRuleData = {goalRuleName: res.goalRuleName, goalRuleValue: res.goalRuleValue, goalRuleType: res.goalRuleType};
let goalRuleComponent = <QuestionItem key={res.goalRuleName} isGoalRule goalRuleData = {goalRuleData}/>
Expand All @@ -214,7 +185,7 @@ class RuleExecutionPage extends React.Component {

_createQuestionnaire=(questionData)=>{

let nextQuestionComponent = <QuestionItem key={questionData.questionText} questionData = {questionData} feedAnswer={this._feedAnswer} editAnswer={this._onEditAnswer}/>;
let nextQuestionComponent = <QuestionItem key={questionData.questionText} questionData = {questionData} feedAnswer={this._feedAnswer}/>;
let tempQuestionnaire = Clone(this.state.questionnaire);
tempQuestionnaire.unshift(nextQuestionComponent);

Expand Down

This file was deleted.

30 changes: 12 additions & 18 deletions ClientSide/src/Interface/Ui/RunRulesPage/Questions/QuestionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import QuestionIntType from './QuestionItems/QuestionIntType/QuestionIntType';
import QuestionBoolType from './QuestionItems/QuestionBoolType/QuestionBoolType';
import QuestionDateType from './QuestionItems/QuestionDateType/QuestionDateType';
import QuestionStringType from './QuestionItems/QuestionStringType/QuestionStringType';
import QuestionDoubleType from './QuestionItems/QuestionDoubleType/QuestionDoubleType';
import QuestionHashType from './QuestionItems/QuestionHashType/QuestionHashType';
import QuestionUrlType from './QuestionItems/QuestionUrlType/QuestionUrlType';
import QuestionUuidType from './QuestionItems/QuestionUuidType/QuestionUuidType';
import QuestionDoubleType from './QuestionItems/QuestionDoubleType';
import QuestionHashType from './QuestionItems/QuestionHashType';
import QuestionUrlType from './QuestionItems/QuestionUrlType';
import QuestionUuidType from './QuestionItems/QuestionUuidType';

import GoalRuleBoolType from './GoalRuleItems/GoalRuleBoolType';
import GoalRuleDateType from './GoalRuleItems/GoalRuleDateType';
Expand Down Expand Up @@ -52,12 +52,6 @@ export default class QuestionItem extends React.Component {
}
}

_onEditAnswer=(question)=>{
if(this.props.editAnswer){
this.props.editAnswer(question)
}
}

_displayGoalRule=()=>{
let goalRuleText = this.props.goalRuleData.goalRuleName;
let goalRuleValue = this.props.goalRuleData.goalRuleValue;
Expand Down Expand Up @@ -93,36 +87,36 @@ export default class QuestionItem extends React.Component {
switch(this.props.questionData.questionValueType)
{
case 'integer':
questionItem = <QuestionIntType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionIntType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'boolean':
questionItem = <QuestionBoolType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionBoolType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'date':
questionItem = <QuestionDateType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionDateType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'defistring':
case 'string':
questionItem = <QuestionStringType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionStringType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'double':
questionItem = <QuestionDoubleType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionDoubleType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'hash':
questionItem = <QuestionHashType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionHashType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'url':
questionItem = <QuestionUrlType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionUrlType question = {questionText} onSave={this._onSaveClick}/>
break;

case 'uuid':
questionItem = <QuestionUuidType question = {questionText} onSave={this._onSaveClick} onEditAnswer={this._onEditAnswer}/>
questionItem = <QuestionUuidType question = {questionText} onSave={this._onSaveClick}/>
break;
}
return questionItem;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import './QuestionBoolType.scss'

export default class QuestionBoolType extends React.Component {
constructor(props) {
super(props);
this.state ={
answered: false,
}
super(props);
}


state ={
answered: false,
}
// prop types and default values
static propTypes = {
question: PropTypes.string.isRequired,
Expand All @@ -38,13 +37,6 @@ export default class QuestionBoolType extends React.Component {
this.setState({answered: true, answer: false});
}
}

_onEditAnswer=()=>{
debugger;
if(this.props.onEditAnswer){
this.props.onEditAnswer(this.props.question);
}
}

// component render method
render() {
Expand All @@ -55,15 +47,13 @@ export default class QuestionBoolType extends React.Component {
<Message attached='top' info header='Is the following statement true?'/>
<Segment attached='bottom' inverted color='green'>
<Header size = 'medium'>{this.props.question}</Header>
<Button color='yellow' floated='right' onClick={this._onEditAnswer}>Edit</Button>
</Segment>
</Segment.Group>
:
<Segment.Group raised className='questionIntItem'>
<Message attached='top' info header='Is the following statement true?'/>
<Segment attached='bottom' inverted color='red'>
<Header size = 'medium'>{this.props.question}</Header>
<Button color='yellow' floated='right' onClick={this._onEditAnswer}>Edit</Button>
</Segment>
</Segment.Group>

Expand Down
Loading