From: Radek Czajka Date: Fri, 25 Jun 2021 15:37:18 +0000 (+0200) Subject: fix X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/ba1734bdc35bfac91d5692389f2d5600e9341370?ds=sidebyside;hp=5715ba5816c2773949689461f715a08caa8c5d11 fix --- diff --git a/src/archive/templates/archive/book.html b/src/archive/templates/archive/book.html index 5a7f273..d17190f 100644 --- a/src/archive/templates/archive/book.html +++ b/src/archive/templates/archive/book.html @@ -64,17 +64,20 @@ – - - {{ audiobook.youtube_volume }} + +
+ {% csrf_token %} + +
+ > + + {{ audiobook.duration|duration }} - - {{ audiobook.duration }} - {% endifchanged %} {% endfor %} diff --git a/src/archive/views.py b/src/archive/views.py index cafda5d..6ae2ef6 100644 --- a/src/archive/views.py +++ b/src/archive/views.py @@ -302,13 +302,12 @@ class BookView(ListView): qs = models.Audiobook.objects.filter(slug=self.kwargs["slug"]).order_by( "index" ) - total = 0 last_vol = None for b in qs: - if last_vol != b.youtube_volume: - last_vol = b.youtube_volume - total = 0 - total = b.total = total + b.duration + if last_vol is None or last_vol.youtube_volume != b.youtube_volume: + last_vol = b + b.total = 0 + last_vol.total += b.duration return list(qs)