-
Notifications
You must be signed in to change notification settings - Fork 43
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
Pipes - Sara Frandsen - Ada Trader #29
base: master
Are you sure you want to change the base?
Conversation
…e tradeList was initialized)
Ada TraderWhat We're Looking For
|
|
||
bySymbol: function(symbol) { | ||
const filtered = this.filter(function (quote) { | ||
return quote.get('symbol') === symbol; |
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.
I like that you broke this out as a separate function on the collection. Good organization!
initialize(params) { | ||
this.buy = params.buy; | ||
this.targetPrice = params.targetPrice; | ||
this.symbol = params.symbol; |
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.
Backbone should copy all this data into the attributes automatically, which you can then access with this.get('targetPrice')
.
initialize(params) { | ||
this.symbol = params.symbol; | ||
this.buy = params.buy; | ||
this.price = params.price; |
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.
Again, should not need to explicitly copy attributes here.
if (this.model.targetPrice < matchingQuote.attributes.price) { | ||
matchingQuote.buy(); | ||
this.bus.trigger('addTrade', trade); // newTrade() in trade_list_view | ||
this.trigger('deleteOrder'); // deleteOrder() above ^^ |
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 not call this.deleteOrder()
directly?
Ada Trader
Congratulations! You're submitting your assignment!
Comprehension Questions