Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def assemble_content_by_chapter(
{usfm_book.book_code for usfm_book in usfm_books}
.union(tn_book.book_code for tn_book in tn_books)
.union(tq_book.book_code for tq_book in tq_books)
.union(tw_book.book_code for tw_book in tw_books)
.union(bc_book.book_code for bc_book in bc_books)
.union(rg_book.book_code for rg_book in rg_books)
)
Expand All @@ -85,9 +84,6 @@ def assemble_content_by_chapter(
selected_tq_books = [
tq_book for tq_book in tq_books if tq_book.book_code == book_code
]
selected_tw_books = [
tw_book for tw_book in tw_books if tw_book.book_code == book_code
]
selected_bc_books = [
bc_book for bc_book in bc_books if bc_book.book_code == book_code
]
Expand All @@ -103,7 +99,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -127,7 +123,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -152,7 +148,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -166,7 +162,7 @@ def assemble_content_by_chapter(
not selected_usfm_books
and not selected_tn_books
and not selected_tq_books
and (selected_tw_books or selected_bc_books or selected_rg_books)
and (tw_books or selected_bc_books or selected_rg_books)
and (
assembly_layout_kind == AssemblyLayoutEnum.ONE_COLUMN
or assembly_layout_kind == AssemblyLayoutEnum.ONE_COLUMN_COMPACT
Expand All @@ -177,7 +173,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -194,7 +190,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand Down Expand Up @@ -364,13 +360,8 @@ def assemble_usfm_by_chapter(
):
content.append(hr)
# Add list of tw words used in chapter
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.book_code == book_code
]
if selected_tw_books:
tw_book = selected_tw_books[0]
if tw_books:
tw_book = tw_books[0]
words = translation_words_for_content(
tw_book, usfm_book.chapters[chapter_num].content
)
Expand Down Expand Up @@ -561,9 +552,7 @@ def assemble_usfm_by_verse_chapter_at_a_time(
if tq_book.book_code == book_code and tq_book.lang_code == lang_code
]
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.book_code == book_code and tw_book.lang_code == lang_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
usfm_book = None
usfm_book2 = None
Expand Down Expand Up @@ -724,12 +713,7 @@ def assemble_tn_by_chapter(
book_chapters: Mapping[str, int] = BOOK_CHAPTERS,
fmt_str: str = settings.LEFT_ALIGNED_HEADER_FMT_STR,
) -> list[str]:
"""
Construct the HTML for a 'by chapter' strategy wherein at least
tn_books exists.
"""
content = []
# TODO Should we use lang_codes again here to ensure order?
if show_tn_book_intro:
for tn_book in tn_books:
content.append(tn_language_direction_html(tn_book))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def assemble_content_by_book(
{usfm_book.book_code for usfm_book in usfm_books}
.union(tn_book.book_code for tn_book in tn_books)
.union(tq_book.book_code for tq_book in tq_books)
.union(tw_book.book_code for tw_book in tw_books)
.union(bc_book.book_code for bc_book in bc_books)
.union(rg_book.book_code for rg_book in rg_books)
)
Expand Down Expand Up @@ -115,9 +114,7 @@ def assemble_content_by_book(
]
tq_book = selected_tq_books[0] if selected_tq_books else None
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.lang_code == lang_code and tw_book.book_code == book_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
tw_book = selected_tw_books[0] if selected_tw_books else None
selected_bc_books = [
Expand Down Expand Up @@ -247,7 +244,6 @@ def assemble_content_by_verse_book_at_a_time(
{usfm_book.book_code for usfm_book in usfm_books}
.union(tn_book.book_code for tn_book in tn_books)
.union(tq_book.book_code for tq_book in tq_books)
.union(tw_book.book_code for tw_book in tw_books)
.union(bc_book.book_code for bc_book in bc_books)
.union(rg_book.book_code for rg_book in rg_books)
)
Expand Down Expand Up @@ -292,9 +288,7 @@ def assemble_content_by_verse_book_at_a_time(
]
tq_book = selected_tq_books[0] if selected_tq_books else None
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.lang_code == lang_code and tw_book.book_code == book_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
tw_book = selected_tw_books[0] if selected_tw_books else None
selected_bc_books = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def assemble_content_by_chapter(
[usfm_book.book_code for usfm_book in usfm_books],
[tn_book.book_code for tn_book in tn_books],
[tq_book.book_code for tq_book in tq_books],
[tw_book.book_code for tw_book in tw_books],
[bc_book.book_code for bc_book in bc_books],
[rg_book.book_code for rg_book in rg_books],
],
Expand All @@ -79,9 +78,6 @@ def assemble_content_by_chapter(
selected_tq_books = [
tq_book for tq_book in tq_books if tq_book.book_code == book_code
]
selected_tw_books = [
tw_book for tw_book in tw_books if tw_book.book_code == book_code
]
selected_bc_books = [
bc_book for bc_book in bc_books if bc_book.book_code == book_code
]
Expand All @@ -94,7 +90,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -111,7 +107,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -128,7 +124,7 @@ def assemble_content_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand All @@ -142,14 +138,14 @@ def assemble_content_by_chapter(
not selected_usfm_books
and not selected_tn_books
and not selected_tq_books
and (selected_tw_books or selected_bc_books or selected_rg_books)
and (tw_books or selected_bc_books or selected_rg_books)
):
document_parts.extend(
assemble_tw_by_chapter(
selected_usfm_books,
selected_tn_books,
selected_tq_books,
selected_tw_books,
tw_books,
selected_bc_books,
selected_rg_books,
use_section_visual_separator,
Expand Down Expand Up @@ -642,9 +638,7 @@ def assemble_usfm_by_verse_chapter_at_a_time(
if tq_book.book_code == book_code and tq_book.lang_code == lang_code
]
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.book_code == book_code and tw_book.lang_code == lang_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
usfm_book = None
usfm_book2 = None
Expand Down Expand Up @@ -1136,7 +1130,7 @@ def assemble_tq_by_chapter(
for tq_book in [
tq_book
for tq_book in tq_books
if tq_book.book_code == tq_book.book_code
if tq_book.book_code == book_code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOL, good catch!

]:
tq_verses = tq_chapter_verses(
tq_book,
Expand Down Expand Up @@ -1175,7 +1169,7 @@ def assemble_tq_by_chapter(
for rg_book in [
rg_book
for rg_book in rg_books
if rg_book.book_code == rg_book.book_code
if rg_book.book_code == book_code
]:
rg_verses = rg_chapter_verses(
rg_book, chapter_num, use_section_visual_separator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ def assemble_content_by_book(
{usfm_book.book_code for usfm_book in usfm_books}
.union(tn_book.book_code for tn_book in tn_books)
.union(tq_book.book_code for tq_book in tq_books)
.union(tw_book.book_code for tw_book in tw_books)
.union(bc_book.book_code for bc_book in bc_books)
.union(rg_book.book_code for rg_book in rg_books)
)
Expand Down Expand Up @@ -115,14 +114,8 @@ def assemble_content_by_book(
if tq_book.lang_code == lang_code and tq_book.book_code == book_code
]
tq_book = selected_tq_books[0] if selected_tq_books else None
# TODO TWBook doesn't really need to have a book_code attribute
# because TW resources are language centric not book centric.
# We could do something about that later if desired for
# design cleanness sake.
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.lang_code == lang_code and tw_book.book_code == book_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
tw_book = selected_tw_books[0] if selected_tw_books else None
selected_bc_books = [
Expand Down Expand Up @@ -251,7 +244,6 @@ def assemble_content_by_verse_book_at_a_time(
{usfm_book.book_code for usfm_book in usfm_books}
.union(tn_book.book_code for tn_book in tn_books)
.union(tq_book.book_code for tq_book in tq_books)
.union(tw_book.book_code for tw_book in tw_books)
.union(bc_book.book_code for bc_book in bc_books)
.union(rg_book.book_code for rg_book in rg_books)
)
Expand Down Expand Up @@ -292,14 +284,8 @@ def assemble_content_by_verse_book_at_a_time(
if tq_book.lang_code == lang_code and tq_book.book_code == book_code
]
tq_book = selected_tq_books[0] if selected_tq_books else None
# TODO TWBook doesn't really need to have a book_code attribute
# because TW resources are language centric not book centric.
# We could do something about that later if desired for
# design cleanness sake.
selected_tw_books = [
tw_book
for tw_book in tw_books
if tw_book.lang_code == lang_code and tw_book.book_code == book_code
tw_book for tw_book in tw_books if tw_book.lang_code == lang_code
]
tw_book = selected_tw_books[0] if selected_tw_books else None
selected_bc_books = [
Expand Down
1 change: 0 additions & 1 deletion backend/doc/domain/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ def __init__(self, localized_word: str, path: str, content: str):
class TWBook(NamedTuple):
lang_code: str
lang_name: str
book_code: str
resource_type_name: str
lang_direction: LangDirEnum
name_content_pairs: list[TWNameContentPair] = []
Expand Down
1 change: 0 additions & 1 deletion backend/doc/domain/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,6 @@ def tw_book_content(
return TWBook(
lang_code=resource_lookup_dto.lang_code,
lang_name=resource_lookup_dto.lang_name,
book_code=resource_lookup_dto.book_code,
resource_type_name=resource_lookup_dto.resource_type_name,
name_content_pairs=name_content_pairs,
lang_direction=resource_lookup_dto.lang_direction,
Expand Down
30 changes: 0 additions & 30 deletions backend/doc/domain/resource_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,12 +1227,6 @@ def nt_survey_rg_passages(
BibleReference(book_code='mat', book_name='Matthew', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None)
"""
path = join(resource_dir, docx_file_path)
# logger.debug("path: %s exists: %s", path, exists(path))
# TODO Check if resource_dir exists and if it doesn't then submit
# a document request to DOC API to make sure it is cloned.
# Currently we don't have to do this because at startup we copy
# English NT Survey RG doc into place.
# assert exists(path)
rg_books = get_rg_books(
path,
lang_code,
Expand Down Expand Up @@ -1275,12 +1269,6 @@ def ot_survey_rg1_passages(
BibleReference(book_code='gen', book_name='Genesis', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None)
"""
path = join(resource_dir, docx_file_path)
# logger.debug("path: %s exists: %s", path, exists(path))
# TODO Check if resource_dir exists and if it doesn't then submit
# a document request to DOC API to make sure it is cloned.
# Currently we don't have to do this because at startup we copy
# English OT Survey RG1 doc into place.
# assert exists(path)
rg_books = get_rg_books(
path,
lang_code,
Expand Down Expand Up @@ -1323,12 +1311,6 @@ def ot_survey_rg2_passages(
BibleReference(book_code='jos', book_name='Joshua', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None)
"""
path = join(resource_dir, docx_file_path)
# logger.debug("path: %s exists: %s", path, exists(path))
# TODO Check if resource_dir exists and if it doesn't then submit
# a document request to DOC API to make sure it is cloned.
# Currently we don't have to do this because at startup we copy
# English OT Survey RG2 doc into place.
# assert exists(path)
rg_books = get_rg_books(
path,
lang_code,
Expand Down Expand Up @@ -1371,12 +1353,6 @@ def ot_survey_rg3_passages(
BibleReference(book_code='job', book_name='Job', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None)
"""
path = join(resource_dir, docx_file_path)
# logger.debug("path: %s exists: %s", path, exists(path))
# TODO Check if resource_dir exists and if it doesn't then submit
# a document request to DOC API to make sure it is cloned.
# Currently we don't have to do this because at startup we copy
# English OT Survey RG3 doc into place.
# assert exists(path)
rg_books = get_rg_books(
path,
lang_code,
Expand Down Expand Up @@ -1419,12 +1395,6 @@ def ot_survey_rg4_passages(
BibleReference(book_code='isa', book_name='Isaiah', start_chapter=2, start_chapter_verse_ref='1-12', end_chapter=None, end_chapter_verse_ref=None)
"""
path = join(resource_dir, docx_file_path)
# logger.debug("path: %s exists: %s", path, exists(path))
# TODO Check if resource_dir exists and if it doesn't then submit
# a document request to DOC API to make sure it is cloned.
# Currently we don't have to do this because at startup we copy
# English OT Survey RG4 doc into place.
# assert exists(path)
rg_books = get_rg_books(
path,
lang_code,
Expand Down
Loading