Skip sync for existing data and too-recent dates
- Check consumption table before fetching; return early if data exists - Return "no data to fetch" for dates >= yesterday (not yet available) - Add sync-month.sh script to sync all days in a month - Add kill-server.sh script to free port 3000 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,12 @@ VALUES (:metering-point-id, :charge-type, :name, :description, :owner,
|
||||
:valid-from-date, :valid-to-date, :period-type, :price, :quantity, :position)
|
||||
ON CONFLICT (metering_point_id, charge_type, name, owner, valid_from_date, position) DO NOTHING;
|
||||
|
||||
-- :name count-consumption-for-date :? :1
|
||||
-- :doc Count consumption records for a given UTC time_start
|
||||
SELECT count(*) AS cnt
|
||||
FROM consumption
|
||||
WHERE time_start = :time-start;
|
||||
|
||||
-- :name insert-production! :! :n
|
||||
-- :doc Insert a production record, skip if already exists
|
||||
INSERT INTO production (time_start, hour, kwh)
|
||||
|
||||
Reference in New Issue
Block a user