2023-05-19 08:08:52 +00:00
|
|
|
from flask import url_for
|
|
|
|
|
|
|
|
from app import models as m
|
|
|
|
|
|
|
|
|
|
|
|
def build_qa_url_using_interpretation(interpretation: m.Interpretation):
|
|
|
|
section: m.Section = interpretation.section
|
|
|
|
collection: m.Collection = section.collection
|
|
|
|
if collection.is_leaf and collection.parent.is_root:
|
|
|
|
collection: m.Collection = collection.parent
|
|
|
|
book: m.Book = section.version.book
|
|
|
|
|
2023-05-30 07:12:43 +00:00
|
|
|
url = url_for("book.qa_view", book_id=book.id, interpretation_id=interpretation.id)
|
2023-05-19 08:08:52 +00:00
|
|
|
return url
|