fixed ordering by title
This commit is contained in:
2
BUGs
2
BUGs
@@ -8,5 +8,3 @@ BUG-46: search (and really all books.html usage), don't deal with sub books
|
||||
(so the code I wrote for author/<id>/books) and use that for search for example
|
||||
- test with search for 'dune'
|
||||
- also test with authors book list for frank herbert
|
||||
|
||||
BUG-47: books on shelf ordering is not working (prod data only?)
|
||||
|
||||
17
main.py
17
main.py
@@ -402,9 +402,20 @@ def search():
|
||||
@app.route("/books", methods=["GET"])
|
||||
@login_required
|
||||
def books():
|
||||
books = Book.query.all()
|
||||
AddSubs(books)
|
||||
return render_template("books.html", books=books )
|
||||
books = Book.query.order_by(Book.title).all()
|
||||
# okay remove subs for now (so only real books are in list)
|
||||
RemSubs(books)
|
||||
# ordered books will be each real book, but if it has any subs, add them back in (but now in the right order/spot)
|
||||
ordered_books=[]
|
||||
for b in books:
|
||||
ordered_books.append(b)
|
||||
subs=db.session.execute( text( f"select * from book_sub_book_link where book_id = {b.id}" ) )
|
||||
for row in subs:
|
||||
s=Book.query.get(row.sub_book_id)
|
||||
ordered_books.append(s)
|
||||
# now get the parent linkages back in so it indents in the front-end html
|
||||
AddSubs(ordered_books)
|
||||
return render_template("books.html", books=ordered_books )
|
||||
|
||||
@app.route("/books_for_loan/<id>", methods=["GET", "POST"])
|
||||
@login_required
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
{% if 'Condition' not in hide_cols %}
|
||||
{% set cond = GetConditionById(book.condition) %}
|
||||
{% if cond == "N/A" %}
|
||||
<td>N/A</td>
|
||||
<td align="center">N/A</td>
|
||||
{% else %}
|
||||
<td align="center">
|
||||
{% if cond == "Good" %}
|
||||
|
||||
Reference in New Issue
Block a user