From 4e1c1595fef6c3b682170a34533edaf88e268d1f Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 3 Feb 2022 13:04:46 +0100 Subject: [PATCH 1/1] New version fixes. --- src/catalogue/models/book.py | 5 +- .../templates/catalogue/2021/book_detail.html | 4 +- src/wolnelektury/settings/static.py | 11 +- .../jquery-ui-1.13.1.custom/AUTHORS.txt | 367 + .../jquery-ui-1.13.1.custom/LICENSE.txt | 43 + .../external/jquery/jquery.js | 10881 ++++++++++++++++ .../images/ui-icons_444444_256x240.png | Bin 0 -> 7090 bytes .../images/ui-icons_555555_256x240.png | Bin 0 -> 7074 bytes .../images/ui-icons_777620_256x240.png | Bin 0 -> 4618 bytes .../images/ui-icons_777777_256x240.png | Bin 0 -> 7111 bytes .../images/ui-icons_cc0000_256x240.png | Bin 0 -> 4618 bytes .../images/ui-icons_ffffff_256x240.png | Bin 0 -> 6487 bytes .../jquery-ui-1.13.1.custom/index.html | 347 + .../jquery-ui-1.13.1.custom/jquery-ui.css | 585 + .../jquery-ui-1.13.1.custom/jquery-ui.js | 2717 ++++ .../jquery-ui-1.13.1.custom/jquery-ui.min.css | 7 + .../jquery-ui-1.13.1.custom/jquery-ui.min.js | 6 + .../jquery-ui.structure.css | 156 + .../jquery-ui.structure.min.css | 5 + .../jquery-ui.theme.css | 446 + .../jquery-ui.theme.min.css | 5 + .../jquery-ui-1.13.1.custom/package.json | 74 + src/wolnelektury/static/js/2022.js | 7 + 23 files changed, 15663 insertions(+), 3 deletions(-) create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/AUTHORS.txt create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/LICENSE.txt create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/external/jquery/jquery.js create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_444444_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_555555_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_777620_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_777777_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_cc0000_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/images/ui-icons_ffffff_256x240.png create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/index.html create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.js create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.min.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.min.js create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.structure.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.structure.min.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.theme.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/jquery-ui.theme.min.css create mode 100644 src/wolnelektury/static/contrib/jquery-ui-1.13.1.custom/package.json create mode 100644 src/wolnelektury/static/js/2022.js diff --git a/src/catalogue/models/book.py b/src/catalogue/models/book.py index ab7a59106..ee8595588 100644 --- a/src/catalogue/models/book.py +++ b/src/catalogue/models/book.py @@ -912,7 +912,10 @@ class Book(models.Model): fragments = Fragment.objects.filter(book__ancestor=self).order_by() fragments_count = fragments.count() if fragments_count: - offset = randint(0, fragments_count - number) + if fragments_count > number: + offset = randint(0, fragments_count - number) + else: + offset = 0 return fragments[offset : offset + number] elif self.parent: return self.parent.choose_fragments(number) diff --git a/src/catalogue/templates/catalogue/2021/book_detail.html b/src/catalogue/templates/catalogue/2021/book_detail.html index f7261ec31..05639bfeb 100644 --- a/src/catalogue/templates/catalogue/2021/book_detail.html +++ b/src/catalogue/templates/catalogue/2021/book_detail.html @@ -30,7 +30,7 @@