fix: correct data display bugs (missing days and months)#109
Open
jrozelle wants to merge 2 commits intoMyElectricalData:mainfrom
Open
fix: correct data display bugs (missing days and months)#109jrozelle wants to merge 2 commits intoMyElectricalData:mainfrom
jrozelle wants to merge 2 commits intoMyElectricalData:mainfrom
Conversation
Backend: - local_data.py: change `date < end_date` to `date <= end_date` in _get_energy_data and _find_missing_ranges (3 locations). In client mode, enedis_client.py does NOT call adjust_date_range(), so the end_date passed directly from the frontend must be treated as inclusive. This caused yesterday's data to be excluded from query results. Frontend - endDate off-by-one: - useConsumptionFetch.ts, useProductionFetch.ts, useDataFetch.ts, ConsumptionEuro/index.tsx, ConsumptionKwh/index.tsx, Production/index.tsx: change endDate from `yesterday` to `today` so that with the inclusive backend query (date <= end_date), yesterday's data is included. Frontend - invalidateQueries key mismatch: - useConsumptionFetch.ts: `['consumption', ...]` → `['consumptionDaily', ...]` - useConsumptionFetch.ts: `['production', ...]` → `['productionDaily', ...]` - useProductionFetch.ts: `['production', ...]` → `['productionDaily', ...]` The query keys did not match, so clicking "Fetch" never invalidated the daily data cache. Stale/incomplete data was reused instead of refetching. Frontend - Tempo chart deduplication bug: - useConsumptionCalcs.ts: the yearsByPreset dedup kept the first occurrence of each label. "2024-2025" appeared first as previousMonths of "2025-2026" (6 months only), then as currentMonths (12 months complete). The old dedup discarded the complete version. Fixed to keep the entry with the most months. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Backend: - Add MaxPowerData model and alembic migration - Add max power local-first endpoint in enedis_client.py - Enhance sync service with better error handling and retry logic - Improve Home Assistant exporter with detailed consumption/production data - Improve MQTT exporter configuration - Add scheduler improvements for data fetching timing - Fix ecowatt router minor issues Frontend: - Add runtime env config support (entrypoint.sh, vite-env.d.ts) - Improve PDLDetails display - Refactor HomeAssistant and MQTT configuration pages - Fix VictoriaMetrics page minor issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bug fixes (commit 1)
Backend - date < end_date → date <= end_date (
local_data.py)enedis_client.pyne passe pas paradjust_date_range(), donc le end_date du frontend est utilisé directementdate < end_dateexcluait la dernière journée (hier) des résultatsdate <= end_datedans_get_energy_dataet_find_missing_ranges(3 endroits)Frontend - endDate = yesterday → today (6 fichiers)
useConsumptionFetch.ts,useProductionFetch.ts,useDataFetch.ts,ConsumptionEuro/index.tsx,ConsumptionKwh/index.tsx,Production/index.tsxend=yesterdaymais le backend a besoin deend=todayavec<=pour inclure hierFrontend - invalidateQueries key mismatch (3 endroits)
invalidateQueries({ queryKey: ['consumption', ...] })ne matchait pas['consumptionDaily', ...]'production'vs'productionDaily'Frontend - déduplication Tempo écrasait les périodes complètes (
useConsumptionCalcs.ts)previousMonthsde "2025-2026" (6 mois partiels)currentMonthscomplet (12 mois), mais le dedup le supprimaitFeatures (commit 2)
Test plan
🤖 Generated with Claude Code