fix: update SQL query in recovery chart payloads for accurate date filtering
- Modified the SQL query in `build_vital_signs_matrix_chart_payload` to use `measured_at::date` for date comparisons, ensuring correct data retrieval based on the measurement date. - Adjusted the order of results to sort by `measured_at` instead of `date`, improving the accuracy of the latest vital signs data fetched.
This commit is contained in:
parent
33b08a8d82
commit
d3cb9d4ad9
|
|
@ -377,8 +377,8 @@ def build_vital_signs_matrix_chart_payload(profile_id: str, days: int) -> Dict[s
|
|||
cur.execute(
|
||||
"""SELECT systolic, diastolic
|
||||
FROM blood_pressure_log
|
||||
WHERE profile_id=%s AND date >= %s
|
||||
ORDER BY date DESC, time DESC
|
||||
WHERE profile_id=%s AND measured_at::date >= %s::date
|
||||
ORDER BY measured_at DESC
|
||||
LIMIT 1""",
|
||||
(profile_id, cutoff),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user