chore: commit mileage updates and accumulated project artifacts

This commit is contained in:
lingniu
2026-09-21 09:15:54 +08:00
parent 6cc872ceb6
commit 8b32ae2988
767 changed files with 572885 additions and 17 deletions
@@ -49,6 +49,8 @@ func main() {
last, e := time.Parse("2006-01-02", *end)
must(e)
mismatches := 0
platformMismatches := 0
platformRows := 0
differences := 0
normal := 0
qualities := map[string]int{}
@@ -57,6 +59,8 @@ func main() {
d := date.Format("2006-01-02")
single, e := r.ReconciledMileageRange(ctx, vins, d, d, priorities)
must(e)
projected, e := r.DailyMileageRange(ctx, vins, d, d, priorities)
must(e)
for _, v := range vins {
key := v + "\x00" + d
value, ok := all[key]
@@ -71,7 +75,14 @@ func main() {
prev, hasPrev := all[v+"\x00"+date.AddDate(0, 0, -1).Format("2006-01-02")]
if value.DataQuality == "" || value.DataQuality == "CARRIED_FORWARD" {
normal++
if hasPrev && math.Abs(value.TotalMileageKm-prev.TotalMileageKm-value.MileageKm) > 0.001 {
if value.PlatformMileage && value.Date == d {
platformRows++
p, ok := projected[key]
if !ok || p.Protocol != value.Protocol || math.Abs(p.MileageKm-value.MileageKm) > 0.001 {
platformMismatches++
}
}
if !value.PlatformMileage && hasPrev && math.Abs(value.TotalMileageKm-prev.TotalMileageKm-value.MileageKm) > 0.001 {
mismatches++
}
}
@@ -80,8 +91,8 @@ func main() {
}
}
}
must(json.NewEncoder(os.Stdout).Encode(map[string]any{"vehicles": len(vins), "rows": len(all), "normal": normal, "qualities": qualities, "reconciliationMismatches": mismatches, "singleRangeDifferences": differences, "samples": samples, "elapsed": time.Since(began).String()}))
if mismatches > 0 || differences > 0 {
must(json.NewEncoder(os.Stdout).Encode(map[string]any{"vehicles": len(vins), "rows": len(all), "normal": normal, "qualities": qualities, "reconciliationMismatches": mismatches, "platformDailyMismatches": platformMismatches, "platformRows": platformRows, "singleRangeDifferences": differences, "samples": samples, "elapsed": time.Since(began).String()}))
if mismatches > 0 || differences > 0 || platformMismatches > 0 {
os.Exit(2)
}
}