log: remove dead _resolve_log_content helper from pages.py

The HTMX log endpoints in api.py do their own localization via
_localized_content; the pages.py helper was added during the
initial localization wiring but was bypassed once HTMX rendering
landed. No call sites remain.
This commit is contained in:
Giorgio Gilestro 2026-05-27 20:39:28 +02:00
parent 664757ea8a
commit eedd32b885
2 changed files with 1 additions and 82 deletions

View file

@ -11,7 +11,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
from app.auth import CurrentUser, maybe_current_user, require_auth, require_token
from app.config import get_settings, load_groups
from app.db import get_session
from app.models import EmailSend, Referral, StrategicLog, StrategicLogTranslation, User
from app.models import EmailSend, Referral, StrategicLog, User
from app.services.access import is_paid_active, paid_status
from app.services.referral_service import assign_code_if_missing
from app.templates_env import templates
@ -75,27 +75,6 @@ async def _resolve_log_date(session: AsyncSession, day: str | None) -> date:
return datetime.now(timezone.utc).date()
async def _resolve_log_content(
session: AsyncSession, log_id: int, lang: str | None,
) -> str:
"""Return the strategic log content in the user's preferred language.
If ``lang`` is 'en'/None or no translation exists for the requested
language, returns the English original from StrategicLog.content.
A missing translation is the expected case for hours where
translation hasn't yet run; the fallback is silent.
"""
if lang and lang != "en":
row = (await session.execute(
select(StrategicLogTranslation)
.where(StrategicLogTranslation.log_id == log_id)
.where(StrategicLogTranslation.lang == lang)
)).scalar_one_or_none()
if row is not None:
return row.content_md
log_row = await session.get(StrategicLog, log_id)
return log_row.content if log_row is not None else ""
def _log_page_context(target: date, paid: bool, user_lang: str = "en") -> dict:
s = get_settings()