-
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
Stef -- Carets #32
base: master
Are you sure you want to change the base?
Stef -- Carets #32
Conversation
… involved the first set of user stories.
…/selling with cost.
WIP, still not working properly with trade costs, ran out of time, will fix this asap. |
…at I need to do will add asap.
Ada TraderWhat We're Looking For
|
buy: true, | ||
symbol: this.$('select[name=symbol]').val(), | ||
targetPrice: parseFloat(this.$('input[name=price-target]').val()), | ||
currentPrice: 0, |
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.
How is the order to get the current quote price? Maybe this view needs to have an instance variable referring to the Quotelist
.
targetPrice: 50.00, | ||
}); | ||
|
||
expect(order.isValid()).toEqual(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.
Validation failing
action: true, | ||
}); | ||
|
||
expect(order.isValid()).toEqual(false); |
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.
Validation failing
else if (!this.buy && this.targetPrice <= this.currentPrice) { | ||
error.targetPrice = ['Price is lower than market, aim higher!']; | ||
} | ||
else if (!attributes.targetPrice) { |
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.
You also need (based on your tests) to check for numeric value for price, boolean value for buy
and maybe check if (!attributes.targetPrice)
first.
const orderData = { | ||
buy: false, | ||
symbol: this.$('select[name=symbol]').val(), | ||
targetPrice: parseFloat(this.$('input[name=price-target]').val()), |
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.
No currentPrice
sellQuote: function() { | ||
this.model.set('buy', false); | ||
let tradeTemplate = _.template($('#trade-template').html()); | ||
$('#trades').prepend(tradeTemplate(this.model.attributes)); |
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.
You should not directly access jQuery in a view. Instead use this.$
to select things within the view. Since the trades section is not within the view you can can trigger
an event and let the larger view handle the prepending.
Ada Trader
Congratulations! You're submitting your assignment!
Comprehension Questions