Goalsystem V1 #50
|
|
@ -245,8 +245,14 @@ def _fetch_by_aggregation_method(
|
|||
- min_30d: Minimum value in last 30 days
|
||||
- max_30d: Maximum value in last 30 days
|
||||
"""
|
||||
# Guard: source_table/column required for simple aggregation
|
||||
if not table or not column:
|
||||
print(f"[WARNING] Missing source_table or source_column for aggregation")
|
||||
return None
|
||||
|
||||
cur = get_cursor(conn)
|
||||
|
||||
try:
|
||||
if method == 'latest':
|
||||
cur.execute(f"""
|
||||
SELECT {column} FROM {table}
|
||||
|
|
@ -323,6 +329,10 @@ def _fetch_by_aggregation_method(
|
|||
print(f"[WARNING] Unknown aggregation method: {method}")
|
||||
return None
|
||||
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Failed to fetch value from {table}.{column} using {method}: {e}")
|
||||
return None
|
||||
|
||||
|
||||
def _execute_calculation_formula(conn, profile_id: str, formula_json: str) -> Optional[float]:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user