Render full functional role summary in reports
This commit is contained in:
@@ -451,6 +451,8 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
|
||||
malefics = snapshot.get('functional_malefics')
|
||||
if not isinstance(benefics, list) or not isinstance(malefics, list):
|
||||
return html
|
||||
neutrals = snapshot.get('functional_neutrals') if isinstance(snapshot.get('functional_neutrals'), list) else []
|
||||
yogakarakas = snapshot.get('yogakarakas') if isinstance(snapshot.get('yogakarakas'), list) else []
|
||||
|
||||
def _escape(value):
|
||||
return html_lib.escape(str(value or ''))
|
||||
@@ -458,6 +460,8 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
|
||||
ascendant = _escape(snapshot.get('ascendant') or snapshot.get('asc_sign') or 'Unknown')
|
||||
benefic_text = _escape(', '.join(str(item) for item in benefics) or 'None')
|
||||
malefic_text = _escape(', '.join(str(item) for item in malefics) or 'None')
|
||||
neutral_text = _escape(', '.join(str(item) for item in neutrals) or 'None')
|
||||
yogakaraka_text = _escape(', '.join(str(item) for item in yogakarakas) or 'None')
|
||||
confidence_text = _escape(snapshot.get('effect_on_confidence') or 'Functional role layer was used in the final judgement.')
|
||||
source_text = _escape(snapshot.get('source') or 'strict_functional_benefic_malefic_v1')
|
||||
|
||||
@@ -469,6 +473,8 @@ class JyotishAPIHandler(BaseHTTPRequestHandler):
|
||||
f'<p style="margin:0 0 8px;"><strong>Ascendant:</strong> {ascendant}</p>'
|
||||
f'<p style="margin:0 0 8px;"><strong>Functional Benefics:</strong> {benefic_text}</p>'
|
||||
f'<p style="margin:0 0 8px;"><strong>Functional Malefics:</strong> {malefic_text}</p>'
|
||||
f'<p style="margin:0 0 8px;"><strong>Functional Neutrals:</strong> {neutral_text}</p>'
|
||||
f'<p style="margin:0 0 8px;"><strong>Yogakarakas:</strong> {yogakaraka_text}</p>'
|
||||
f'<p style="margin:0 0 8px;"><strong>Confidence Impact:</strong> {confidence_text}</p>'
|
||||
f'<p style="margin:0;color:#5b6472;font-size:13px;"><strong>Source:</strong> {source_text}</p>'
|
||||
'</section>'
|
||||
|
||||
@@ -445,6 +445,8 @@ def test_report_artifact_can_render_functional_benefic_malefic_summary() -> None
|
||||
'ascendant': 'Leo',
|
||||
'functional_benefics': ['Sun', 'Mars', 'Jupiter'],
|
||||
'functional_malefics': ['Venus', 'Saturn'],
|
||||
'functional_neutrals': ['Mercury'],
|
||||
'yogakarakas': ['Mars'],
|
||||
'effect_on_confidence': '高严谨模式下必须叠加功能性吉凶星。',
|
||||
},
|
||||
})
|
||||
@@ -455,6 +457,10 @@ def test_report_artifact_can_render_functional_benefic_malefic_summary() -> None
|
||||
assert 'Leo' in html
|
||||
assert 'Sun, Mars, Jupiter' in html
|
||||
assert 'Venus, Saturn' in html
|
||||
assert 'Mercury' in html
|
||||
assert 'Mars' in html
|
||||
assert 'Yogakarakas' in html
|
||||
assert 'Functional Neutrals' in html
|
||||
assert '高严谨模式下必须叠加功能性吉凶星。' in html
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user