diff --git a/templates/books_for_series.html b/templates/books_for_series.html index 286e90d..451b0fe 100644 --- a/templates/books_for_series.html +++ b/templates/books_for_series.html @@ -3,7 +3,6 @@ TitleBook Number - {% set last = namespace(val=0) %} {% for book in books %} @@ -30,10 +29,14 @@ {% set num = SeriesBookNum( series.id, book.id ) %} {% if num == None %} - {# okay, if this is a parent book, the num == None, so make it use last real-book and add .01 to it to make sure it sorts just after the last one #} - + {# okay, if this is a parent book, the num == None, so find first child / sub_book's book number in the series #} + {# then we treat each book_num as a 0-leading 3 digit number - for the parent book we minus 1 from it #} + {% set tmp = SeriesBookNum( series.id, book.child_ref[0].sub_book_id ) %} + {% set num = "{:02d}0".format( tmp ) %} + {% set num = num|int - 1 %} + {% else %} - + {% endif %} {% for s in book.series %} {% if not book.child_ref|length %} @@ -57,7 +60,6 @@ {% endif %} {% endif %} - {% set last.val = num %} {% endfor %}