From 1c512b0d0a83bfa0bcb98836b94ee72f177309e4 Mon Sep 17 00:00:00 2001 From: Lars Date: Tue, 21 Apr 2026 08:12:21 +0200 Subject: [PATCH] refactor: simplify best lag value handling in energy correlation calculations - Updated the `_correlate_energy_weight` function to streamline the unpacking of the `best` variable, removing unnecessary tuple elements for improved clarity and efficiency in the correlation logic. --- backend/data_layer/correlations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/data_layer/correlations.py b/backend/data_layer/correlations.py index a0ed2fc..dd0568c 100644 --- a/backend/data_layer/correlations.py +++ b/backend/data_layer/correlations.py @@ -170,7 +170,7 @@ def _correlate_energy_weight(profile_id: str, max_lag: int) -> Optional[Dict]: balance_by = {d: kcal_by[d] - tdee_f for d in kcal_by} - best: Optional[Tuple[int, float, int, List[Tuple[int, float]]]] = None + best: Optional[Tuple[int, float, int]] = None lag_details: List[Dict[str, Any]] = [] max_l = max(0, min(int(max_lag), 28)) @@ -211,7 +211,7 @@ def _correlate_energy_weight(profile_id: str, max_lag: int) -> Optional[Dict]: "tdee_kcal_used": round(tdee_f, 0), } - lag_b, r_b, n_b, _ = best + lag_b, r_b, n_b = best direction = _direction_from_r(r_b) conf = _lag_confidence(n_b, r_b) interp = (