-
Notifications
You must be signed in to change notification settings - Fork 187
Conversation
.ratingStrip { | ||
.ratingIcons { | ||
display: inline-flex; | ||
flex-direction: row-reverse; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wish we had a previous sibling selector in CSS. Instead, I'm fudging it with reversing the order in flex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I saw one place that might be duplicate code, and there are two console logs still in there, if this isn't the last PR for this section then they aren't an issue.
}; | ||
|
||
this.rating.set(data); | ||
this.rating.set(data, { validate: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the data get set twice here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that I want to both validate the model and set with potentially invalid values. If you set with the validate option, the model will not set those attributes if any are invalid. But.. since I'm re-rendering the errors, I want them in the model.
Normally, this can be avoided by using Model.save(), which does set the attributes and will also validate, but in this case I don't want that because Save will kick off a request to the server if there are no errors and the request to the server will happen in the utility function.
This PR adds in the ability to complete an order and leave a review.