Always send numeric queue position in upload notification email
Mirror and run GitLab CI / build (push) Has been cancelled
Ruff / ruff (push) Has been cancelled

This commit is contained in:
admin
2026-06-14 17:00:06 +00:00
parent f7c9c70bfc
commit 50c7ec90a0
3 changed files with 17 additions and 16 deletions
+15 -14
View File
@@ -291,26 +291,25 @@ def create_transcript_docx(text: str, filename: str):
- 12pt Courier
- Continuous line numbering on the left
- Speaker names capitalized and indented; spoken text further indented
- No section headings; use bold/underline only.
"""
doc = Document()
section = doc.sections[0]
# Margins
# Set margins via section properties
section = doc.sections[0]
section.left_margin = Inches(1.5)
section.right_margin = Inches(1.0)
section.top_margin = Inches(1.0)
section.bottom_margin = Inches(1.0)
# Line numbering (continuous, left side)
section_type = section.element.find(qn("w:sectionPr"))
if section_type is None:
section_type = OxmlElement("w:sectionPr")
section.element.insert(0, section_type)
line_num = OxmlElement("w:lineNumbering")
line_num.set(qn("w:start"), "continuous")
line_num.set(qn("w:countBy"), "1")
section_type.append(line_num)
# Enable continuous line numbering on the left
sectPr = section._element
lnNumType = sectPr.find(qn("w:lnNumType"))
if lnNumType is None:
lnNumType = OxmlElement("w:lnNumType")
sectPr.append(lnNumType)
lnNumType.set(qn("w:start"), "continuous")
lnNumType.set(qn("w:countBy"), "1")
# Default font
style = doc.styles["Normal"]
@@ -329,15 +328,16 @@ def create_transcript_docx(text: str, filename: str):
m = re.match(r"\[(\d+:\d+(?::\d+)?)\]\s*(.+?):\s*(.*)", line)
if m:
ts, speaker, content = m.groups()
# Speaker line
# Speaker line: bold, underlined, indented
p_spk = doc.add_paragraph()
p_spk.paragraph_format.left_indent = Inches(0.25)
run_spk = p_spk.add_run(f"[{ts}] {speaker.upper()}")
run_spk.bold = True
run_spk.underline = True
run_spk.font.name = "Courier"
run_spk.font.size = Pt(12)
# Spoken text line
# Spoken text line: further indented
p_txt = doc.add_paragraph()
p_txt.paragraph_format.left_indent = Inches(0.5)
run_txt = p_txt.add_run(content.strip())
@@ -356,6 +356,7 @@ def create_transcript_docx(text: str, filename: str):
def create_summary_docx(text: str, filename: str):
"""
Create a .docx summary with consistent font.
No section headings; use bold/underline only.
"""
doc = Document()
style = doc.styles["Normal"]
+1 -1
View File
@@ -118,7 +118,7 @@ def send_initial_email(to: str, queue_pos: int):
try:
html = load_template(
"upload_notification_template.html",
queue_position=str(queue_pos) if queue_pos > 0 else "the queue",
queue_position=str(max(queue_pos, 1)),
)
except EmailError as e:
logger.warning("Failed to render upload notification template: %s", e)