fix(aspects): pass planet speed into the three production callers (BUG-1479, upstream e628118d)
aspects.py itself is in d226b0e53 because it was already staged. Ketu and applying/separating behavior are covered by the geometry test. Callers pass numeric speeds, or None when speed is absent. calc_house_aspects does not take speed.
Co-Authored-By: Grok (agent loop)
This commit is contained in:
co-authored by
Grok (agent loop)
parent
bd09485243
commit
8aed605a43
@@ -7674,11 +7674,18 @@ class JyotishComputeService(VedastroEvidenceMixin, SynastryMixin):
|
||||
return {}
|
||||
|
||||
def _compute_aspects(self, body):
|
||||
_, planet_lons = self._planet_lons_from_body(body)
|
||||
planets, planet_lons = self._planet_lons_from_body(body)
|
||||
if len(planet_lons) < 2:
|
||||
raise BadRequest('planets must include at least two longitude values')
|
||||
asc_lon = self._asc_lon_from_body(body)
|
||||
result = _load_local_module('aspects').calc_all_aspects(planet_lons, asc_lon)
|
||||
planet_speeds = {
|
||||
name: float(row['speed'])
|
||||
for name, row in (planets or {}).items()
|
||||
if isinstance(row, dict) and isinstance(row.get('speed'), (int, float))
|
||||
}
|
||||
result = _load_local_module('aspects').calc_all_aspects(
|
||||
planet_lons, asc_lon, planet_speeds=planet_speeds or None,
|
||||
)
|
||||
return {
|
||||
'success': True,
|
||||
'endpoint': 'aspects',
|
||||
|
||||
@@ -14376,11 +14376,19 @@ def cmd_aspects(args):
|
||||
return {"error": f"aspects模块导入失败: {e}"}
|
||||
planets = chart.get('planets', {})
|
||||
planet_lons = {}
|
||||
planet_speeds = {}
|
||||
for pn, pd in planets.items():
|
||||
if isinstance(pd, dict) and 'degree' in pd:
|
||||
planet_lons[pn] = pd['degree']
|
||||
if isinstance(pd, dict) and isinstance(pd.get('speed'), (int, float)):
|
||||
planet_speeds[pn] = float(pd['speed'])
|
||||
asc_deg = chart.get('ascendant', {}).get('lon', chart.get('ascendant', {}).get('degree', 0))
|
||||
return _build_response_envelope('aspects', calc_all_aspects(planet_lons, asc_deg), args=args, execution_status='executed')
|
||||
return _build_response_envelope(
|
||||
'aspects',
|
||||
calc_all_aspects(planet_lons, asc_deg, planet_speeds=planet_speeds or None),
|
||||
args=args,
|
||||
execution_status='executed',
|
||||
)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -16235,7 +16243,12 @@ def cmd_full_reading(args):
|
||||
stage_started = time.perf_counter()
|
||||
try:
|
||||
from aspects import calc_all_aspects, calc_house_aspects
|
||||
aspects_result = calc_all_aspects(planet_lons, asc_deg)
|
||||
aspect_speeds = {
|
||||
name: float(row['speed'])
|
||||
for name, row in (chart.get('planets') or {}).items()
|
||||
if isinstance(row, dict) and isinstance(row.get('speed'), (int, float))
|
||||
}
|
||||
aspects_result = calc_all_aspects(planet_lons, asc_deg, planet_speeds=aspect_speeds or None)
|
||||
aspects_result['house_aspects'] = [
|
||||
calc_house_aspects(float(planet_lons[planet]), planet, asc_deg)
|
||||
for planet in ('Sun', 'Moon', 'Mars', 'Mercury', 'Jupiter', 'Venus', 'Saturn')
|
||||
|
||||
Reference in New Issue
Block a user