completed TODO-09: list of books to buy - no printable, I can just get live data on phone anyway
This commit is contained in:
11
main.py
11
main.py
@@ -679,16 +679,13 @@ def FindMissingBooks():
|
||||
# check to see if the only books in this series are SOLD, if so, there
|
||||
# are no missing books here, I clearly dont want more of this series
|
||||
for b in bsl:
|
||||
print("b={}".format( b ) )
|
||||
if b.book_num == None:
|
||||
continue
|
||||
missing.remove( b.book_num )
|
||||
tmp_book=Book.query.get(b.book_id)
|
||||
if tmp_book.owned == sold[0].id:
|
||||
num_sold = num_sold + 1
|
||||
if num_sold == t.count:
|
||||
print( "Seems that all the books in this {} are Sold, should not list it".format(t.title))
|
||||
else:
|
||||
if num_sold != t.count:
|
||||
# turn missing from array into string, and strip 0 and last char (the square brackets)
|
||||
books.append( { 'id': t.id, 'title': t.title, 'num_books': t.num_books, 'missing': str(missing)[1:-1] } )
|
||||
return books
|
||||
@@ -703,6 +700,12 @@ def wishlist():
|
||||
books = Book.query.join(Owned).filter(Owned.name=='On Wish List').all()
|
||||
return render_template("books.html", books=books, page_title="Books On Wish List", show_cols='', hide_cols='Publisher,Condition,Covertype' )
|
||||
|
||||
@app.route("/books_to_buy", methods=["GET"])
|
||||
def books_to_buy():
|
||||
books = Book.query.join(Owned).filter(Owned.name=='On Wish List').all()
|
||||
missing = FindMissingBooks()
|
||||
return render_template("to_buy.html", books=books, missing=missing, page_title="Books To Buy")
|
||||
|
||||
@app.route("/needs_replacing", methods=["GET"])
|
||||
def needs_replacing():
|
||||
books = Book.query.join(Condition,Owned).filter(Condition.name=='Needs Replacing',Owned.name=='Currently Owned').all()
|
||||
|
||||
Reference in New Issue
Block a user