if someone would please help me, I've been struggling with this for hours. I am receiving this failure of a check within check50 for pset7 finance:
:( sell handles valid sale expected to find "56.00" in page, but it wasn't found
Log sending POST request to /login sending POST request to /sell checking that "56.00" is in page
Per the specification of pset7 index:
index Complete the implementation of index in such a way that it displays an HTML table summarizing, for the user currently logged in, which stocks the user owns, the numbers of shares owned, the current price of each stock, and the total value of each holding (i.e., shares times price). Also display the user’s current cash balance along with a grand total (i.e., stocks' total value plus cash).
Odds are you’ll want to execute multiple SELECTs. Depending on how you implement your table(s), you might find GROUP BY, HAVING, SUM, and/or WHERE of interest.
Odds are you’ll want to call lookup for each stock.
So I am not outputting any sales onto the HTML table in index.html
And per the specification of sell
sell Complete the implementation of sell in such a way that it enables a user to sell shares of a stock (that he or she owns).
Require that a user input a stock’s symbol, implemented as a select menu whose name is symbol. Render an apology if the user fails to select a stock or if (somehow, once submitted) the user does not own any shares of that stock.
Require that a user input a number of shares, implemented as a text field whose name is shares. Render an apology if the input is not a positive integer or if the user does not own that many shares of the stock.
Submit the user’s input via POST to /sell.
You don’t need to worry about race conditions (or use transactions).
It doesn't mention outputting the total price of the sale after completion, so I am not doing that. However, check50 complains that the sale price is not visible after completing a purchase. So, I am redirecting to "/history", which includes ALL purchases/sales.
Per the specification for history:
history Complete the implementation of history in such a way that it displays an HTML table summarizing all of a user’s transactions ever, listing row by row each and every buy and every sell.
For each row, make clear whether a stock was bought or sold and include the stock’s symbol, the (purchase or sale) price, the number of shares bought or sold, and the date and time at which the transaction occurred.
You might need to alter the table you created for buy or supplement it with an additional table. Try to minimize redundancies.
History does not say to output the current available cash, or total value of holdings + available cash. However, if I don't check50 will find the value of the recent sale it is trying to find, but then will complain that the available cash is not visible. In my opinion, this psets specification is EXTREMELY confusing in relation to check50's expected output for certain checks.
[code snipped to avoid spoilers]
My own output after buying 2 of the same stock, then selling 1 of them and being redirected to /history after the POST to the /sell route: