completed: TODO-22: adding a sub-book when the parent book is in a series, and renamed MAYBE-1 to TODO-23 (deal with moving book in a series with another series involved), 24 (dockerise), 25 (actually allow removing just one subbook form series)

This commit is contained in:
2021-01-07 16:02:04 +11:00
parent 6cd2d735ca
commit 9560381a87
3 changed files with 15 additions and 10 deletions

1
BUGs
View File

@@ -12,4 +12,3 @@ BUG-7: if you remove a series from a book, it won't appear in the series drop-d
### ordering of data in UI: ### 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 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) - 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)

18
README
View File

@@ -27,16 +27,14 @@ python3 main.py
MUST use form.errors when we have a validator that is fancier than not empty (year_published in book and num_books in series SO FAR) MUST use form.errors when we have a validator that is fancier than not empty (year_published in book and num_books in series SO FAR)
#### MAYBEs: #### TODOS (next 26):
MAYBE-1: when moving a book in a series (which is part of 2 series), do we pop-up offer to move parent/child series orders as well to match (think Thomas Covenant) TODO-25: allow removing of just this sub-book from a series -- can cause a need by messing with UI, so should just add it as a possible in the dialog box
TODO-23: when moving a book in a series (which is part of 2 series), do we pop-up offer to move parent/child series orders as well to match (think Thomas Covenant)
TODO-24: get this into docker (as per TODO above)
gunicorn and it seems easy enough: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04
#### TODOS (next 22): TODO-08: show books on shelf list
TODO-5: should deleting really just ask if want to mark it as SOLD? IN FACT, make delete button disabled until its sold... (and a tooltip to explain) TODO-09: show books to buy view / printable
TODO-22: adding a sub-book when the parent book is in a series, need to add bsl(s) for it and make it the next (probably)
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)
TODO-8: show books on shelf list
TODO-9: show books to buy view / printable
TODO-11: show unrated books (with toggle to exclude those with missing in a series) TODO-11: show unrated books (with toggle to exclude those with missing in a series)
TODO-12: show books missing from a series (I own only some of them) TODO-12: show books missing from a series (I own only some of them)
TODO-13: show books on wish list TODO-13: show books on wish list
@@ -51,5 +49,7 @@ TODO-19: icons on wish list, etc.? (not sure I really want them, but if so)
- wishlist: search-dollar OR https://www.flaticon.com/free-icon/wishlist_868517 - wishlist: search-dollar OR https://www.flaticon.com/free-icon/wishlist_868517
- save: https://www.flaticon.com/free-icon/sold_463255?term=sold&page=1&position=6&related_item_id=463255 - save: https://www.flaticon.com/free-icon/sold_463255?term=sold&page=1&position=6&related_item_id=463255
TODO-05: should deleting really just ask if want to mark it as SOLD? IN FACT, make delete button disabled until its sold... (and a tooltip to explain)
TODO-20: ORM all books load is slow 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()....) - 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

@@ -410,6 +410,12 @@ def new_book():
db.session.commit() db.session.commit()
if 'parent_id' in request.form: if 'parent_id' in request.form:
db.engine.execute( "insert into book_sub_book_link ( book_id, sub_book_id, sub_book_num ) values ( {}, {}, (select COALESCE(MAX(sub_book_num),0)+1 from book_sub_book_link where book_id = {}) )".format( request.form['parent_id'], book.id, request.form['parent_id'] ) ) db.engine.execute( "insert into book_sub_book_link ( book_id, sub_book_id, sub_book_num ) values ( {}, {}, (select COALESCE(MAX(sub_book_num),0)+1 from book_sub_book_link where book_id = {}) )".format( request.form['parent_id'], book.id, request.form['parent_id'] ) )
parent=Book.query.get(request.form['parent_id'])
print( parent.series )
if len(parent.series) > 0:
print ("I think this means we have added a sub-book to something in a series already" )
for s in parent.bsl:
db.engine.execute( "insert into book_series_link ( series_id, book_id, book_num ) values ( {}, {}, {} )".format( s.series_id, book.id, (s.book_num+1) ) )
db.session.commit() db.session.commit()
st.SetMessage( "Created new Book ({})".format(book.title) ) st.SetMessage( "Created new Book ({})".format(book.title) )
cnt=1 cnt=1