De-hardcode the book count.

This commit is contained in:
barnold 2022-10-12 19:09:06 +01:00
parent 2dcbf93505
commit 179be1f700
2 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,11 @@ use Mojo::Base 'Mojolicious::Controller', -signatures;
use MyModel::Book;
use MyModel::Author;
sub about ($self) {
my $book_count = MyModel::Book->new(rows_per_page => $self->rpp)->count_all;
$self->render(book_count => $book_count);
}
sub books ($self) {
my $page_number = $self->accept_posint($self->param('page_number'));
if (!defined $page_number) {

View File

@ -8,7 +8,8 @@
Thanks to <a href="https://www.gutenberg.org/">Project
Gutenberg</a>, this is a site for looking through the book catalog
they generously provide. It's a personal project and is not
affiliated with Project Gutenberg. The site currently offers 51,922
affiliated with Project Gutenberg. The site currently offers
<%= commify($book_count) %>
book records out of 68,670 in the catalog.
</p>