feat(tajika): Mudda Dasha from natal Moon nakshatra + completed years, not the year lord (BUG-1216)

Ports calc_mudda_with_dasha_balance verbatim from upstream yinduzhanxing
c7117f92 (astrologer round-5 Q7). tajika_mudda.annual_mudda_dasha is the one
product entry for solar_return_full_report, cmd_tajika and full-reading
Step 9; periods are cropped to the Varsha year and carry months for the
month-window consumers. The consultation card re-anchors the engine's dates.

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-03 21:09:31 +08:00
co-authored by Claude Opus 5.5
parent 59bb7da385
commit 9d81f15afa
8 changed files with 513 additions and 49 deletions
+13 -6
View File
@@ -379,6 +379,10 @@ def calc_solar_return_chart(
sun_data = birth_chart.get('planets', {}).get('Sun', {})
birth_sun_lon = sun_data.get('degree_raw', sun_data.get('degree', 0))
# Natal Moon for Mudda Dasha (BUG-1216: first lord from the natal
# Moon nakshatra, astrologer round-5 Q7).
moon_data = birth_chart.get('planets', {}).get('Moon', {})
birth_moon_lon = moon_data.get('degree_raw', moon_data.get('degree')) if isinstance(moon_data, dict) else None
birth_jd_ut = birth_jd
# Step 2: 计算太阳返照精确时刻
@@ -435,6 +439,7 @@ def calc_solar_return_chart(
'ascendant': ascendant,
'asc_sign_idx': sr_asc_idx,
'birth_asc_sign_idx': birth_asc_idx,
'birth_moon_longitude': birth_moon_lon,
'target_year': target_year,
'birth_year': birth_year,
'annual_location': {'latitude': annual_lat, 'longitude': annual_lon,
@@ -619,16 +624,18 @@ def solar_return_full_report(
except Exception as e:
result['tri_pataka'] = {'error': str(e)}
# 7. Mudda Dasha(需 asc_sign_idx + year_lord,降级模式跳过)
# 7. Mudda Dasha:出生月宿 + 已满年数起运,与年主无关(占星师第五轮问 7,
# BUG-1216)。与 cmd_tajika 共用 tajika_mudda.annual_mudda_dasha。降级模式跳过。
if degraded:
result['mudda_dasha'] = {'error': 'swisseph未安装,无法计算Mudda Dasha(需完整星盘)'}
else:
try:
from tajika import calc_mudda_dasha
yl_data = result.get('year_lord', {})
yl = yl_data.get('year_lord', '')
mudda = calc_mudda_dasha(asc_sign_idx, yl, birth_month or 1)
result['mudda_dasha'] = mudda
from tajika_mudda import annual_mudda_dasha
result['mudda_dasha'] = annual_mudda_dasha(
annual_start=sr['solar_return'].get('dt_local'),
completed_years=age,
natal_moon_longitude=sr.get('birth_moon_longitude'),
)
except Exception as e:
result['mudda_dasha'] = {'error': str(e)}