fixed bug / improved how we sort parent books, we now sort it based on the first sub_books spot in the series, not the last book we retrieved from the db ordered by book.id - this does not always work if we make a parent book after other books in a series (or move books), then it was printed out of order
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% set last = namespace(val=0) %}
|
||||
{% for book in books %}
|
||||
<tr>
|
||||
<td id="{{book.id}}">
|
||||
@@ -30,10 +29,14 @@
|
||||
</td>
|
||||
{% 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 #}
|
||||
<td data-sort="{{series.id}}.{{"{:02d}1".format( last.val )}}">
|
||||
{# 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 %}
|
||||
<td data-sort="{{series.id}}{{"{:03d}".format( num )}}">
|
||||
{% else %}
|
||||
<td data-sort="{{series.id}}.{{"{:02d}".format( num )}}">
|
||||
<td data-sort="{{series.id}}{{"{:02d}0".format( num )}}">
|
||||
{% endif %}
|
||||
{% for s in book.series %}
|
||||
{% if not book.child_ref|length %}
|
||||
@@ -57,7 +60,6 @@
|
||||
{% endif %}
|
||||
</script>
|
||||
{% endif %}
|
||||
{% set last.val = num %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user