Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple choice #135

Merged
merged 13 commits into from
Feb 16, 2017
Merged

Multiple choice #135

merged 13 commits into from
Feb 16, 2017

Conversation

BenHSmith13
Copy link
Contributor

No description provided.

}

markedForDeletion(choice) {
const { question } = this.props.item;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this modifying some object deep in the props?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup

# Conflicts:
#	client/js/_author/components/assessments/_edit_assessment.jsx
#	client/js/_author/components/assessments/_new_assessment.jsx
#	client/js/_author/components/assessments/assessment_form.jsx
#	client/js/_author/components/assessments/assessment_items.jsx
#	client/js/_author/components/assessments/question_types/_question.jsx
});
}

moveChoice(choice, up) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have the options know their index, so you don't have to do the find stuff?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and pass their index as a parameter to the move function


const newIndex = up ? index - 1 : index + 1;

const earlierItem = choices[newIndex];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this modifying the store without an action? Maybe rearrange a clone of these?

@@ -80,29 +77,18 @@ export class EditAssessment extends React.Component {
);
}

updateAssessment() {
updateAssessment(newFields) {
const { assessment } = this.props;
this.props.updateAssessment(
this.props.params.bankId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to merge javascript objects here instead of merging each property on the object manually? Then it might be more future proof if you ever need to add a property other than those 3.

this.props.updateItem(
{
id,
name: newItemProperties.name || displayName.text,
description: newItemProperties.description || description.text,
question: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might make sense to merge objects here as well.

# Conflicts:
#	client/js/_author/components/assessments/assessment_items.jsx
#	client/js/_author/components/assessments/question_types/_question.jsx
#	client/js/_author/components/assessments/question_types/multiple_choice.jsx
# Conflicts:
#	client/js/_author/components/assessments/_edit_assessment.jsx
#	client/js/_author/components/assessments/assessment_form.jsx
#	client/js/_author/components/assessments/assessment_items.jsx
#	client/js/_author/components/assessments/question_types/_question.jsx
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0009%) to 99.001% when pulling 1028b83 on multiple_choice into a15e722 on master.

description: this.state.assessment.description,
id: this.props.params.id,
},
{ ...{ id: this.props.params.id }, ...newFields },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why bother with ...{ id: this.props.params.id }, why not just { id: this.props.params.id, ...newFields }

};

this.props.updateItem(newItem);
this.props.updateItem({ ...{ id: item.id }, ...newItemProperties });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, why bother splaying a single key?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0009%) to 99.001% when pulling caba302 on multiple_choice into a15e722 on master.

@BenHSmith13 BenHSmith13 merged commit 329736b into master Feb 16, 2017
@BenHSmith13 BenHSmith13 deleted the multiple_choice branch February 16, 2017 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants