new sqlaclhemy needs separated .join()s

This commit is contained in:
2023-07-05 19:44:50 +10:00
parent 80ce668089
commit 3564334a76

View File

@@ -966,7 +966,7 @@ def books_on_shelf():
@app.route("/unrated_books", methods=["GET"])
@login_required
def unrated_books():
books = Book.query.join(Rating,Owned).filter(Rating.name=='Undefined',Owned.name=='Currently Owned').all()
books = Book.query.join(Rating).join(Owned).filter(Rating.name=='Undefined',Owned.name=='Currently Owned').all()
return render_template("books.html", books=books, page_title="Books with no rating", show_cols='Rating', hide_cols='' )
def FindMissingBooks():
@@ -1017,7 +1017,7 @@ def books_to_buy():
@app.route("/needs_replacing", methods=["GET"])
@login_required
def needs_replacing():
books = Book.query.join(Condition,Owned).filter(Condition.name=='Needs Replacing',Owned.name=='Currently Owned').all()
books = Book.query.join(Condition).join(Owned).filter(Condition.name=='Needs Replacing',Owned.name=='Currently Owned').all()
return render_template("books.html", books=books, page_title="Books that Need Replacing", show_cols='', hide_cols='' )
@app.route("/sold", methods=["GET"])
@@ -1029,7 +1029,7 @@ def sold_books():
@app.route("/poor_rating", methods=["GET"])
@login_required
def poor_rating_books():
books = Book.query.join(Rating,Owned).filter(Rating.id>6,Rating.name!='Undefined',Owned.name=='Currently Owned').all()
books = Book.query.join(Rating).join(Owned).filter(Rating.id>6,Rating.name!='Undefined',Owned.name=='Currently Owned').all()
return render_template("books.html", books=books, page_title="Books that have a Poor Rating (<5 out of 10)", show_cols='Rating', hide_cols='' )