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: enter image description here

  • EDIT: Sorry, I initially posted the wrong output from check50. Fixed.
    – JohnWick
    Commented Mar 15, 2018 at 23:45

1 Answer 1


Again, as in your other question, check50 is looking at index.html page after you sell stock. The spec doesn't say to redirect to a history page, so you shouldn't.

In this example, check50 buys 4 shares of a stock (for $112.00 total) and then sells 2 shares, leaving you with 2 shares worth $56.00 and a new cash balance of $9,944.00 which are the values it is looking for on index.html.

  • Hi, thanks for the response. The spec for index does not say to list sales. So if I redirect to index after selling, the value $56.00 will be nowhere to be found (so check50 will fail there). Although $9,944.00 would be. Hope that makes sense...
    – JohnWick
    Commented Mar 15, 2018 at 23:50
  • 1
    and this isn't testing for a list of sales. It's checking that the current portfolio has 2 shares worth $56.00 and a cash balance of $9,944.00.
    – curiouskiwi
    Commented Mar 15, 2018 at 23:51
  • Gotcha. It would be nice if the spec for sell said to redirect to index after a sale, though. That's why I wasn't in the first place. I pass all check50 checks now, FINALLY!
    – JohnWick
    Commented Mar 15, 2018 at 23:56
  • 1
    The assumption is that you will run the staff version to see how it should behave. Anyway, glad you got it fixed. :)
    – curiouskiwi
    Commented Mar 16, 2018 at 0:00
  • You are a lifesaver :D
    – JohnWick
    Commented Mar 16, 2018 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .