fixed new BUG where adding a sub-book to a parent with a series could not work out book_num
This commit is contained in:
2
main.py
2
main.py
@@ -415,7 +415,7 @@ def new_book():
|
||||
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.engine.execute( "insert into book_series_link ( series_id, book_id, book_num ) values ( {}, {}, (select COALESCE(MAX(book_num),0)+1 from book_series_link where series_id={}) )".format( s.series_id, book.id, s.series_id ) )
|
||||
db.session.commit()
|
||||
st.SetMessage( "Created new Book ({})".format(book.title) )
|
||||
cnt=1
|
||||
|
||||
@@ -66,7 +66,6 @@ function ConfirmRemoveThisSubs_ParentAndSubsFromSeries(pid,bid,rem)
|
||||
Cancel Series change</button>
|
||||
</div class="row">
|
||||
`
|
||||
console.log(rem.length)
|
||||
if( rem.length > 1 )
|
||||
{
|
||||
all='for <span style="background:red" class="text-white"><em>ALL</em></span> series'
|
||||
@@ -94,7 +93,7 @@ function SeriesButPlus(num) {
|
||||
}
|
||||
|
||||
function AddBookToSeries() {
|
||||
console.log("add Book to series")
|
||||
console.log("add Book to series")
|
||||
|
||||
// Read the Number from that DIV's ID (i.e: 3 from "series-div-3") -- could
|
||||
// also be the filler (series-div-0), thats ok too
|
||||
@@ -140,7 +139,7 @@ console.log( "reset buttons on last_div is=" + last_div.prop('id') )
|
||||
}
|
||||
|
||||
function RemoveBookFromSeries(sid) {
|
||||
console.log("remove Book from Series: " + sid )
|
||||
console.log("remove Book from Series: " + sid )
|
||||
$('#'+sid).remove()
|
||||
|
||||
var num = parseInt( sid.match(/\d+/g), 10 );
|
||||
@@ -413,7 +412,6 @@ function AddAuthorToBook(num) {
|
||||
<script>
|
||||
$(document).ready( function() {
|
||||
$("#sub_book_content").load("/subbooks_for_book/{{books.id}}")
|
||||
console.log( {{CheckSeriesChange.removing_series|safe}} )
|
||||
{% if CheckSeriesChange is defined and CheckSeriesChange != None %}
|
||||
{% if CheckSeriesChange.type == 'parent' %}
|
||||
ConfirmRemoveParentAndSubsFromSeries( {{CheckSeriesChange.pid}}, {{CheckSeriesChange.bid}},
|
||||
|
||||
Reference in New Issue
Block a user