fix dataTables ordering when I dont expect it to for books on shelf view
This commit is contained in:
15
main.py
15
main.py
@@ -909,7 +909,7 @@ def books_on_shelf():
|
||||
|
||||
# start with all books owned by title, but it includes sub-books, so remove them...
|
||||
# books = Book.query.join(Owned).filter(Owned.name=='Currently Owned').order_by(Book.title).all()
|
||||
books = Book.query.join(Owned,Book_Author_Link,Author).filter(Owned.name=='Currently Owned',Book_Author_Link.author_num==1).order_by(Author.surname,Author.firstnames,Book.title).all()
|
||||
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
|
||||
@@ -951,6 +951,8 @@ def books_on_shelf():
|
||||
ordered_books.append(b)
|
||||
|
||||
# return render_template("books.html", books=ordered_books, page_title="Books on Shelf", order_by="Author(s)", show_cols='', hide_cols='' )
|
||||
for o in ordered_books:
|
||||
print( f"ord: {o.title}" )
|
||||
return render_template("books.html", books=ordered_books, page_title="Books on Shelf", order_by="", show_cols='', hide_cols='' )
|
||||
|
||||
@app.route("/unrated_books", methods=["GET"])
|
||||
@@ -1026,13 +1028,16 @@ def poor_rating_books():
|
||||
@app.route("/fix_an")
|
||||
@login_required
|
||||
def fix_an():
|
||||
print("A")
|
||||
books=Book.query.all();
|
||||
print("B")
|
||||
for b in books:
|
||||
print( f"process {b.title}")
|
||||
cnt=1
|
||||
for a in b.author:
|
||||
bal=Book_Author_Link.query.filter(Book_Author_Link.book_id==b.id,Book_Author_Link.author_id==a.id,Book_Author_Link.author_num == 0 ).first()
|
||||
bal.author_num=cnt
|
||||
db.session.add(bal)
|
||||
for a in b.bals:
|
||||
print( f"process bal {cnt} for {b.title}")
|
||||
a.author_num=cnt
|
||||
db.session.add(a)
|
||||
cnt+=1
|
||||
db.session.commit()
|
||||
return render_template("base.html", alert="success", message="Fixed author numbering" )
|
||||
|
||||
Reference in New Issue
Block a user