Questions tagged [index]
The index tag has no usage guidance.
71 questions
0
votes
1
answer
130
views
CS50x Pset9 - Finance - checking that "112.00" is in page - buy handles valid purchase
I've tried everything I can think of but I just cant figure out what I'm doing wrong.
I've got all the index values, and all other values for that matter, showing in USD.
I have a catch in the py.app ...
0
votes
1
answer
424
views
PSET 9 Finance Index Function (jinja2.exceptions.UndefinedError: 'row' is undefined)
I have tried using dot notation in the index.html for loop. I referred to Lab 9 to check my syntax and ensure that I am passing variables correctly from app.py. I have also used flash(stock_rows[0][&...
0
votes
0
answers
36
views
Finance Index: Lookup won't accept subscripted argument
I'm working on index in finance. This is my code:
@app.route("/")
@login_required
def index():
id = session["user_id"]
stocks = db.execute("SELECT symbol, SUM(shares) ...
0
votes
1
answer
190
views
Cs50 Finance :(sell handle valid sales :values appearing in index table but check50 doesnt recognise it
updated the code to display history properly,ie when sold shows negative,and when bought shows positive
updated index to remove entire row when stocks is 0
I cant figure out why check 50 is not ...
0
votes
1
answer
299
views
pset9: finance // jinja syntax error in index
I'm working on my index page and I have two errors. For the first, I'm not sure what's wrong. It seems like it's something with my return statement but I have no idea what's wrong with it.
File "...
0
votes
1
answer
368
views
Pset 9 Finance index function, current stock price not displaying correctly
I am working on getting the proper information to display on the index page. I have one piece left, and it is displaying the current value of the stock. When I look at my output for my 'user' and '...
0
votes
1
answer
936
views
CS50 Finance index doesn't display what it needs to
I'm at the last check for the 'buy' part and I keep getting:
:( buy handles valid purchase
expected to find "9,888.00" in page, but it wasn't found
I'm pretty sure that number is supposed to ...
0
votes
1
answer
59
views
Buy/Sell on Index - button attributes & form value issues
I've got a couple issues adding my own buy/sell buttons to the index page.
First, each "Buy" or "Sell" buttons opens up the form for all of the table rows. How can I modify these ...
1
vote
1
answer
3k
views
pset9 Finance "jinja2.exceptions.TemplateSyntaxError: expected name or number" error
In my index function, every time I try "flask run" it outputs that error (jinja2.exceptions.TemplateSyntaxError: expected name or number). Everywhere I've checked most people have been ...
0
votes
1
answer
214
views
Pset8 Finance personal touch
I decided to go with trading from index without manually typing the symbol. Also, I decided to simply go to the buy/sell page with the symbol pre-selected by a GET method (without quantities being ...
0
votes
2
answers
93
views
Finance - Index showing correct number of rows but all the same record. For- loop issue?
So I've been looking at this all morning and can't figure what I'm doing wrong. All my variables are producing the correct values so it seems to be something to do with my For loop. In the html ...
0
votes
1
answer
196
views
FINANCE: GROUP BY doesn't add up the numbers of shares of the same stock
So in index i'm trying to display a table with all the stocks that the user has bought, one row for each stock, displaying the total number of shares in the user's portfolio along with the total value ...
0
votes
1
answer
398
views
Problem Set 8 / Finance. How to incorporate current price (index)
I'm currently struggling with index(). In buy() I created the custom table with, one might say, too many columns. Among others are symbol, name, shares, price, total.
So far I was able to plug some of ...
1
vote
1
answer
391
views
CS50 Finance: Index - list indices must be integers or slices, not str
I've been stuck on this for quite some time. I believe that I'm getting back data in the form of a dictionary but can't figure out how to get the information that I need.
Error messages that have ...
0
votes
1
answer
369
views
Finance index function does not return lookup value in index.html
I'm trying to render my lookup values inside of my index function implementation, but I cannot get these values to render in my index.html page. I added share = lookup(record['share_symbol']) to grab ...
0
votes
1
answer
91
views
Finance index.html is not rendering values from my index function
I'm having some issues trying to render values on my index.html page. In my index function, I created a dictionary of values from my transactions table to grab each record of my share symbols, share ...
0
votes
1
answer
56
views
Runtime error in pset4
I'm currently working on filter.c, and I'm struggling with the blur segment of it. I tried to write a code (I'm aware it's a mess of hard-code, but it's an attempt!), but I keep getting this error:
...
0
votes
1
answer
40
views
Finance Portfolio (index) I can't go on. Need to take to HTML the actual price and total of stock
I am stopped at this part of Finance now.
I can print at HTML the symbol and the sum of the shares... but I don't know how to take the iteration for each symbol to the HTML to know the actual price ...
1
vote
2
answers
191
views
My Coleman-Liau index gives the wrong answer
the program seems to be running fine but I don't know what went wrong in the index, it just doesn't give the right answer.
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#...
0
votes
1
answer
246
views
Finance - Error with Index
I can't seem to figure out where I've gone wrong with index. I keep running into these two errors:
After login, when directing to index - 500: Internal Server Error (raise TypeError("...
0
votes
1
answer
72
views
Pset8 Finance - SELECT is blank
Stock holdings are not printing on my index webpage. "cash" prints correctly. I think the SELECT on my finance.activity table is somehow coming up blank. I am not receiving any errors, and when I ...
0
votes
1
answer
173
views
Pset8 finance, index not working after migrating to new IDE, why?
My "index" was working fine, but it no longer works and i get the 500 internal server error now, which has been happening after migrating to the new IDE.
I does not seem to be my code. Here is what ...
0
votes
1
answer
174
views
Pset7 - index() ValueError: could not convert string to float
I got ValueError: could not convert string to float at line 66
grand_total = total_holdings + float(current_cash[0]["cash"])
Can anyone show me my mistake? current_cash[0]["cash"] returns a string....
0
votes
1
answer
456
views
pset7 finance: index not working after register
I have an issue with my index function after a user newly registers. After registering, a new row is created in the table users with a cash value set to 10000 by default.
After registering, the user ...
0
votes
1
answer
57
views
When I go to '/' page for Finance it only shows the cash I have available
I've been struggling for hours with trying to get the '/' page to display the current portfolio. It displays the remaining cash fine but nothing else. On phpliteadmin I can see that the table gets ...
0
votes
1
answer
155
views
pset7 index function won't iterate through stocks
I'm having some serious trouble getting the index function to iterate through each of the user's stocks to obtain the current market price. It correctly outputs a list of the user's stocks along with ...
0
votes
1
answer
2k
views
Pset7 index TypeError: quote_from_bytes() expected bytes
Pset7 index.
I’m getting raise TypeError("quote_from_bytes() expected bytes")
TypeError: quote_from_bytes() expected bytes.
I tried several times to rewrite the code but I always come across this ...
0
votes
1
answer
142
views
Pset7 index RuntimeError object has no attribute name
I’m working on index part for two days now and I’m keep getting AttributeError: 'RuntimeError' object has no attribute 'name'. I changed things around but still the same error. Please, help me.
0
votes
1
answer
84
views
Pset7 finance, after I run buy function, portfolio table updated check 50 fails and I get 404 error
after I run check 50, everything shows green except these:
I am trying to fix the error for buy. After I run flask and tried to make purchase, it shows 404 however my portfolio table get updated. So ...
0
votes
1
answer
750
views
pset7 finance register and index check50 error
I have implemented all functions. However when i run check50, it gets following errors
The errors might come from my index code. I am not sure. Below are my code for register and index. Any ...
0
votes
1
answer
556
views
Problem retrieving index variables in finance
The table is not able to access different variables to display in the table.
Here is the index function
def index():
"""Show portfolio of stocks"""
"""Selecting shares that have been purchased ...
0
votes
1
answer
33
views
TypeErrors and variable storage questions
I have been struggling with this problem set (pset7) for a couple weeks now and I have looked at countless resources while trying to get my code working. I am the point where I do not remember what is ...
0
votes
2
answers
690
views
pset7 finance/index problem updating values in table
First time asking question, sorry if formatted badly.
I am trying to set up to update my price and total column in my sql table.
I seem to have it mostly correct, as values are being updated properly, ...
0
votes
1
answer
276
views
pset7 index table not showing all values
When I try to use index, the table doesn't show all the values:
[![erroneous table][1]][1]
I'm not sure why it only shows some. My index code is as follows:
def index():
"""Show portfolio of ...
0
votes
1
answer
61
views
why can't I even log in now ? pset7
code:
def index():
"""Show portfolio of stocks"""
portfolio_symbols = db.execute("SELECT shares, symbol \
FROM log WHERE id = :id", \
...
0
votes
1
answer
183
views
pset7 index TypeError: 'NoneType' object is not subscriptable error
Me again with this error. I do not know what happened, this has been working for a couple of weeks and I have not changed the code (though I did copy and paste it) but all of a sudden this afternoon I ...
0
votes
1
answer
91
views
pset7 "index" - using SQL SUM adds a parenthesis to returned dict strings
I executed the following to return a dict (grouped by stock symbols) of stock symbols, total shares and total value owned.
stocks = db.execute("SELECT buy.stock_code, SUM(buy.value), SUM(buy.shares) ...
1
vote
1
answer
113
views
Pset7 Finance Unable to Buy Multiple Shares
I am able to make 1 purchase which appears on my index page, however if I try buy any further stocks my cash goes down but the stocks are not shown and aren't inserted into my portfolio.
Here is my ...
0
votes
1
answer
564
views
pset7 index fields are empty in page
When I logged into the webpage and bought a stock, the price of the stock was deducted from the cash balance. However, the details of all the other fields are missing as shown in the picture below. I ...
0
votes
1
answer
122
views
cs50 pset7 finance always get an error in valid buy execution;;;;;
@app.route("/")
@login_required
def index():
"""Show portfolio of stocks"""
cash = db.execute('SELECT cash FROM users where id=:id',id=session["user_id"])
cash = cash[0]["cash"]
stocks ...
0
votes
1
answer
311
views
pset7 - Buy doesn't return correct value
I've ran into an issue while running Check50 on what I thought was my functioning solution for pset7, namely it doesn't find the correct value in the index after trying to run the buy function.
This ...
1
vote
2
answers
181
views
Pset7 => "NoneType" error on SELECT query (2017)
I’m really stuck on the index part of PSET7….
Flask keeps iterating over the following SELECT query:
dab = db.execute("SELECT SUM(share) FROM portfolio WHERE symbol = :symbol AND user_id = :user_id",...
1
vote
2
answers
4k
views
pset7 index TypeError: 'NoneType' object is not subscriptable
I'm working on pset7 index, and I've hit a snag. When I try to log in and render index, I get this error: TypeError: 'NoneType' object is not subscriptable
It says the main error is on line 50: name =...
0
votes
1
answer
135
views
pset7 index only one stock gets passed into html
My code for index is at https://pastebin.com/Ct7xCdYv.
My code for html is at https://pastebin.com/VFFAWEzc
Currently, I'm just trying to get the code for the stocks in, and will then tackle adding ...
0
votes
2
answers
311
views
Querying portfolio for index route PSET7/C$50 Finance/index
I have created a table named "portfolio" in my database which stores users purchase data while I kept the user_id field of this table NOT UNIQUE ie no primary key so as to let the user buy more same ...
0
votes
1
answer
344
views
Pset7 Index not outputting some fields in table
I am in desperate need of help, since the index method is the last method I have left to finish for this pset! So far, my index code works partially - as in, only the values I passed in from my ...
1
vote
1
answer
206
views
Why is my table in index.html pset7 showing up blank? (for dummies)
I've been stuck on this for a couple hours now, it seems that whatever I put into my for loop in my index for html doesn't print at all? Thoughts?
index method:
def index():
portfolio = db.execute("...
0
votes
2
answers
133
views
pset 7 [buy] Unable to render user's cash
I've spent a lot of time trying to solve this problem and can't seem to find were I went wrong. Any help is greatly appreciated.
I am unable to render the user's cash balance on the index.
def ...
0
votes
1
answer
326
views
Index Pset7 - Symbol, Shares, and Total show [] instead of value
I was able to successfully create my index table and it shows the Name and Price correctly. However, it only shows [] for the values of Symbol, Shares, and Total.
Here is my code:
// edited out
I'...
0
votes
2
answers
3k
views
pset2 caesar converting from ascii to alphabetical
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc == 2)
{
int ...