fixed BUG-12: remove loaned out books from results of search for books to add to a loan

This commit is contained in:
2021-01-05 11:09:51 +11:00
parent 336ae4b67f
commit 2028266ff7
3 changed files with 10 additions and 5 deletions

8
BUGs
View File

@@ -1,11 +1,15 @@
#### BUGS (next-13)
### DB/back-end
BUG-2: series does not deal with calcd_rating...
- (on edit could, recalc as a catch-all, and obviously if we change a single book's rating, we should re-calc)
BUG-13: deleting loan fails with book_loan_link data still existing
### UI not updating after DB change:
BUG-3: alter a condition, covertype, etc. and its not in drop-down list (even though db look via index is correct, e.g books.html shows updated covertype)
BUG-7: if you remove a series from a book, it won't appear in the series drop-down if it is the first 'missing' book in that series -- either reset the list, or show all series always?
### ordering of data in UI:
BUG-6: author,series, etc. do not have explicit ordering like sub-books... sort of irritating / needs code and DB fix
- add/remove authors, and after save they are ordered by author.id, not order of addition (prob. needs book_author_link to have an auth_num)
BUG-7: if you remove a series from a book, it won't appear in the series drop-down if it is the first 'missing' book in that series -- either reset the list, or show all series always?
BUG-12: remove loaned out books from results of search for books to add to a loan

1
README
View File

@@ -55,4 +55,3 @@ TODO-19: icons on wish list, etc.? (not sure I really want them, but if so)
TODO-20: ORM all books load is slow
- should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....)
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)

View File

@@ -230,12 +230,14 @@ book_schema = BookSchema()
####################################### ROUTES #######################################
@app.route("/search", methods=["POST"])
def search():
books = Book.query.filter(Book.title.ilike("%{}%".format(request.form['term']))).all()
AddSubs(books)
if 'InDBox' in request.form:
# removes already loaned books from list of books to loan out
books = Book.query.outerjoin(Book_Loan_Link).filter(Book.title.ilike("%{}%".format(request.form['term'])),Book_Loan_Link.loan_id==None).all()
InDBox=1
else:
books = Book.query.filter(Book.title.ilike("%{}%".format(request.form['term']))).all()
InDBox=0
AddSubs(books)
return render_template("books.html", books=books, InDBox=InDBox)
@app.route("/books", methods=["GET"])