created OrderBooks covenience function, then didnt use it elsewhere ;)
This commit is contained in:
22
main.py
22
main.py
@@ -911,14 +911,7 @@ def rem_parent_books_from_series(pid):
|
|||||||
db.session.commit()
|
db.session.commit()
|
||||||
return jsonify(success=True)
|
return jsonify(success=True)
|
||||||
|
|
||||||
@app.route("/books_on_shelf", methods=["GET"])
|
def OrderBooks(books):
|
||||||
@login_required
|
|
||||||
def books_on_shelf():
|
|
||||||
|
|
||||||
# start with all books owned sorted by author, then title, but it includes sub-books, so remove them...
|
|
||||||
books = Book.query.join(Owned).join(Book_Author_Link).join(Author).filter(Owned.name=='Currently Owned').filter(Book_Author_Link.author_num==1).order_by(Author.surname,Author.firstnames,Book.title).all()
|
|
||||||
RemSubs(books)
|
|
||||||
|
|
||||||
# because a book can be in multiple series, without any ordering we need to find
|
# because a book can be in multiple series, without any ordering we need to find
|
||||||
# any book that is in a series, then go through each series to find the one with
|
# any book that is in a series, then go through each series to find the one with
|
||||||
# the most books in it. THEN we need to get all those books and put them in the
|
# the most books in it. THEN we need to get all those books and put them in the
|
||||||
@@ -954,8 +947,19 @@ def books_on_shelf():
|
|||||||
ordered_books.append(tmp_b)
|
ordered_books.append(tmp_b)
|
||||||
processed.append(tmp_b.id)
|
processed.append(tmp_b.id)
|
||||||
else:
|
else:
|
||||||
# book not in a series or a sub-book, so just add this book to the ordered list
|
# book not in a series and we removed sub-books, so just add this book to the ordered list
|
||||||
ordered_books.append(b)
|
ordered_books.append(b)
|
||||||
|
return ordered_books
|
||||||
|
|
||||||
|
@app.route("/books_on_shelf", methods=["GET"])
|
||||||
|
@login_required
|
||||||
|
def books_on_shelf():
|
||||||
|
|
||||||
|
# start with all books owned sorted by author, then title, but it includes sub-books, so remove them...
|
||||||
|
books = Book.query.join(Owned).join(Book_Author_Link).join(Author).filter(Owned.name=='Currently Owned').filter(Book_Author_Link.author_num==1).order_by(Author.surname,Author.firstnames,Book.title).all()
|
||||||
|
RemSubs(books)
|
||||||
|
|
||||||
|
ordered_books=OrderBooks(books)
|
||||||
|
|
||||||
return render_template("books.html", books=ordered_books, page_title="Books on Shelf", order_by="", show_cols='', hide_cols='' )
|
return render_template("books.html", books=ordered_books, page_title="Books on Shelf", order_by="", show_cols='', hide_cols='' )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user