Fix candidate mileage review findings
This commit is contained in:
@@ -50,3 +50,13 @@ Result:
|
||||
- `SamplesFromEnvelope` now carries `EventTime` and `DeviceID`, which the new candidate mapping needs.
|
||||
- The upsert SQL is focused on the candidate table and reuses the shared `Execer` interface.
|
||||
- No unrelated stats files were modified.
|
||||
|
||||
## Review Fix Addendum
|
||||
- Preserved manual `platform_name` values when the candidate upsert receives blank runtime input by switching to `COALESCE(NULLIF(TRIM(VALUES(platform_name)), ''), platform_name)`.
|
||||
- Bootstrapped `vehicle_data_source`, `vehicle_daily_mileage_source`, and `vehicle_daily_mileage` before running alter statements in `Writer.EnsureSchema`.
|
||||
- Added a defensive blank `SourceIP` guard in `UpsertSourceMileage` so malformed candidate rows are skipped instead of written.
|
||||
- Removed the SQL comment that existed only to satisfy a string-match test and updated the focused assertions to check the real `daily_mileage_km` and `platform_name` SQL expressions.
|
||||
- Verification run:
|
||||
- `go test ./internal/stats -run 'TestUpsertSourceMileage|TestWriterEnsuresSchema' -count=1`
|
||||
- `go test ./internal/stats -count=1`
|
||||
- Both passed.
|
||||
|
||||
Reference in New Issue
Block a user