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:
6
main.py
6
main.py
@@ -410,6 +410,12 @@ def new_book():
|
||||
db.session.commit()
|
||||
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'] ) )
|
||||
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()
|
||||
st.SetMessage( "Created new Book ({})".format(book.title) )
|
||||
cnt=1
|
||||
|
||||
Reference in New Issue
Block a user