def main(): current_book = get_current_book() last_progress_info = db.session.query(Progress).filter_by(book_id=current_book.id, user_id=current_user.id) \ .order_by(Progress.id.desc()).first() if current_book is not None else None form = ProgressForm() form.id.data = current_book.id form.progress.data = last_progress_info.progress if last_progress_info else 0 return render_template("home/home.html", current_book=current_book, form=form)
def progress_graph(): return render_template("progress/progress.html", book=get_current_book())