Timeline for pset7 finance check50 doesn't detect a valid sale despite portfolio updating correctly
Current License: CC BY-SA 4.0
16 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 15, 2018 at 6:06 | vote | accept | Kewal Shah | ||
Sep 7, 2018 at 12:34 | history | edited | Kewal Shah | CC BY-SA 4.0 |
Added new test screenshot
|
Sep 5, 2018 at 2:02 | answer | added | curiouskiwi♦ | timeline score: 3 | |
Sep 4, 2018 at 18:26 | comment | added | DinoCoderSaurus | Maybe adding a "short-circuit" in helpers.py can help you figure out what check50 "sees". Something like : if (symbol.upper() == "CS50"): #//shortcircuit for check50 repro return { "name": symbol.upper(), # for backward compatibility with Yahoo "price": 28.00, "symbol": symbol.upper() } at the beginning of lookup fn. And then follow along with check50 (register a user, buy 4 shares of cs50, sell 2 shares of cs50). It shouldn't hurt, and it might help. | |
Sep 3, 2018 at 12:14 | history | edited | Kewal Shah | CC BY-SA 4.0 |
removed unnecessary j loop
|
Sep 3, 2018 at 12:10 | comment | added | Kewal Shah |
@Blauelf yes, the j loop in sell was unnecessary but as you said removing it didn't change anything. Also thanks for suggesting to use "/" . and an alias for sum, I'll keep that in mind.
|
|
Sep 3, 2018 at 11:34 | comment | added | Blauelf |
No error locally? The j loop in sell makes no sense, not sure if that matters. Have you tried an alias for the aggregate field? Like for example SELECT stock, SUM(shares) AS sum_shares FROM ... and then rows[i]["sum_shares"] . The automatic name might differ from what you expect. Also, have you tried replacing url_for("index") with "/" ? Had a problem with HTTP/HTTPS that was solved by that one (VM webserver running on HTTP, but accessed via HTTPS). I would have liked to use url_for instead.
|
|
Sep 3, 2018 at 10:01 | comment | added | Kewal Shah | I am stuck on the last test since two days, please upvote the question if you aren't able to figure out the problem like me. It will be a great help! | |
Sep 3, 2018 at 9:52 | history | edited | Kewal Shah | CC BY-SA 4.0 |
added log snippet
|
Sep 3, 2018 at 9:38 | comment | added | Kewal Shah |
@Blauelf Yes of course, there is a separate test for that which my code passes :) sell page has all required elements
|
|
Sep 3, 2018 at 9:22 | comment | added | Blauelf | Does your number formatting code work for values without decimals? Oh, must be, earlier tests already checked that :( Are you using correct field names in your form? | |
Sep 3, 2018 at 9:15 | comment | added | Kewal Shah |
@Blauelf yes I did encounter a similar problem, but i solved it by formatting my values to 2 decimal places ($123.4 instead of $123.40 ) and that is why check50 passes the :) buy handles valid purchase test. It is only in the sell portion that I am getting an error. Please check this log: cs50.me/checks/bf480fb67ba5c92d487fb4f201f3bd155e4512d7 and see if you can help me
|
|
Sep 3, 2018 at 9:03 | comment | added | Blauelf |
Is there some value you don't format using usd filter for display? I failed at some point because I did the formatting myself at one point and displayed like $123.4 instead of $123.40 . Changing all to usd fixed that for me.
|
|
Sep 3, 2018 at 4:48 | comment | added | Kewal Shah | @DinoCoderSaurus by current price I mean price that is returned by the lookup function as is required in the specifications | |
Sep 2, 2018 at 22:12 | comment | added | DinoCoderSaurus |
Clarification please: The heading on index says "Current Price". Are you displaying the price at which the stock was purchased or current price as from lookup ? This check50 failure is invariably a problem in index (route or .html).
|
|
Sep 2, 2018 at 17:08 | history | asked | Kewal Shah | CC BY-SA 4.0 |