{% extends "base.html" %} {% block content %}

{{ book.title }}

by {{ book.author }}
{% set rating = book.get_average_rating() %} {% for i in range(1, 6) %} {% endfor %} {{ "%.1f"|format(rating) }} ({{ book.get_rating_count() }} reviews)
{{ book.genre }}

{{ book.description }}

{% if book.publication_year %}
Published:
{{ book.publication_year }}
{% endif %} {% if book.pages %}
Pages:
{{ book.pages }}
{% endif %} {% if book.publisher %}
Publisher:
{{ book.publisher }}
{% endif %} {% if book.isbn %}
ISBN:
{{ book.isbn }}
{% endif %}
{% if current_user.is_authenticated %}
Rate This Book
{% if user_rating %}

You rated this book {{ user_rating.rating }} stars

{% if user_rating.review %}

"{{ user_rating.review }}"

{% endif %}

Update your rating:

{% endif %}
{{ rating_form.hidden_tag() }}
{{ rating_form.rating.label(class="form-label") }} {{ rating_form.rating(class="form-select") }}
{{ rating_form.review.label(class="form-label") }} {{ rating_form.review(class="form-control", placeholder="Share your thoughts about this book...") }}
{{ rating_form.submit(class="btn btn-warning") }}
Reading Status
{% if user_reading_status %}

Status: {{ user_reading_status.status.replace('_', ' ').title() }}

{% if user_reading_status.notes %}

"{{ user_reading_status.notes }}"

{% endif %}

Update your status:

{% endif %}
{{ status_form.hidden_tag() }}
{{ status_form.status.label(class="form-label") }} {{ status_form.status(class="form-select") }}
{{ status_form.notes.label(class="form-label") }} {{ status_form.notes(class="form-control", placeholder="Add personal notes...") }}
{{ status_form.submit(class="btn btn-primary") }}
{% else %}
Sign in to rate and track this book
{% endif %}
{% if similar_books %}

Similar Books

{% for similar_book, score in similar_books %}
{{ similar_book.title }}

by {{ similar_book.author }}

{% set rating = similar_book.get_average_rating() %} {% for i in range(1, 6) %} {% endfor %}
{{ "%.0f"|format(score * 100) }}% similar {{ similar_book.genre }}
{% endfor %}
{% endif %} {% if ratings %}

Recent Reviews

{% for rating in ratings %}
{{ rating.user.username }}
{% for i in range(1, 6) %} {% endfor %}
{% if rating.review %}

{{ rating.review }}

{% endif %}
{{ rating.created_at.strftime('%b %d, %Y') }}
{% endfor %}
{% endif %}
{% endblock %} {% block scripts %} {% endblock %}