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>
|
<tr class="thead-light"><th>Title</th><th>Book Number</th></tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% set last = namespace(val=0) %}
|
|
||||||
{% for book in books %}
|
{% for book in books %}
|
||||||
<tr>
|
<tr>
|
||||||
<td id="{{book.id}}">
|
<td id="{{book.id}}">
|
||||||
@@ -30,10 +29,14 @@
|
|||||||
</td>
|
</td>
|
||||||
{% set num = SeriesBookNum( series.id, book.id ) %}
|
{% set num = SeriesBookNum( series.id, book.id ) %}
|
||||||
{% if num == None %}
|
{% 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 #}
|
||||||
<td data-sort="{{series.id}}.{{"{:02d}1".format( last.val )}}">
|
{# 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 %}
|
{% else %}
|
||||||
<td data-sort="{{series.id}}.{{"{:02d}".format( num )}}">
|
<td data-sort="{{series.id}}{{"{:02d}0".format( num )}}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for s in book.series %}
|
{% for s in book.series %}
|
||||||
{% if not book.child_ref|length %}
|
{% if not book.child_ref|length %}
|
||||||
@@ -57,7 +60,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% set last.val = num %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user