fix(api): yoga list is not cut to ten; an evaluated empty list is not replaced by a preview (upstream e9beae6b)

TASK-upstream-sync4-20261002 T4. Regression tests follow in the same branch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-10-02 13:53:20 +08:00
co-authored by Claude Opus 5.5
parent f3ed950982
commit 96767418ee
+6 -7
View File
@@ -6299,12 +6299,11 @@ class JyotishAPIHandler(BaseHTTPRequestHandler, VedastroEvidenceMixin, SynastryM
normalized['houses'] = chart.get('houses') or modules.get('house_map') or {}
normalized['dasha'] = modules.get('dasha') or chart.get('dasha') or {}
yoga_module = modules.get('yoga') if isinstance(modules.get('yoga'), dict) else {}
normalized['yogas'] = (
chart.get('yogas')
or yoga_module.get('yogas')
or yoga_module.get('detected_yogas')
or []
)
# Presence, not truthiness (upstream e9beae6b): an evaluated empty list
# must not resurrect an older chart preview; the full module comes first.
normalized['yogas'] = next((rows for rows in (
yoga_module.get('yogas'), yoga_module.get('detected_yogas'), chart.get('yogas')
) if isinstance(rows, list)), [])
normalized['ashtakavarga'] = modules.get('ashtakavarga') or chart.get('ashtakavarga') or {}
normalized['shadbala'] = modules.get('shadbala') or chart.get('shadbala') or {}
normalized['birth'] = chart.get('birth_info') or full_reading.get('birth_info') or {}
@@ -7133,7 +7132,7 @@ class JyotishAPIHandler(BaseHTTPRequestHandler, VedastroEvidenceMixin, SynastryM
import logging
logging.warning(f"[api_server] yoga expansion in _detect_yogas failed: {e}")
return yogas[:10]
return yogas
def _compute_remedies(self, body):
remedies_module = _load_local_module('remedies')