feat: manual odometer baseline — Settings field computes baseline + trip distance, Dashboard shows (manual) label

This commit is contained in:
Mathieu Moran
2026-08-11 18:51:11 -04:00
parent 887a001723
commit 34253b3ffb
7 changed files with 58 additions and 30 deletions
+7 -2
View File
@@ -153,7 +153,7 @@
<div class="fw-bold fs-5 text-dark" id="stat-topspeed">—</div>
</div>
<div class="col-6 col-lg-12">
<div class="text-xs text-muted fw-bold text-uppercase mb-1">Odometer</div>
<div class="text-xs text-muted fw-bold text-uppercase mb-1" id="stat-odometer-label">Odometer</div>
<div class="fw-bold fs-5 text-dark" id="stat-odometer">—</div>
</div>
<div class="col-6 col-lg-12">
@@ -268,7 +268,12 @@
document.getElementById('stat-km').textContent = d.total_km.toFixed(1) + ' km';
document.getElementById('stat-time').textContent = d.total_duration_s > 0 ? fmtDuration(d.total_duration_s) : '—';
document.getElementById('stat-topspeed').textContent = d.all_time_max_speed > 0 ? d.all_time_max_speed + ' km/h' : '—';
document.getElementById('stat-odometer').textContent = d.odometer_km != null ? Math.round(d.odometer_km).toLocaleString() + ' km' : '—';
const odoEl = document.getElementById('stat-odometer');
const odoLabel = document.getElementById('stat-odometer-label');
odoEl.textContent = d.odometer_km != null ? Math.round(d.odometer_km).toLocaleString() + ' km' : '—';
if (odoLabel && d.odometer_source === 'manual') {
odoLabel.textContent = 'Odometer (manual)';
}
document.getElementById('stat-videos').textContent = d.video_count;
const dtcEl = document.getElementById('stat-dtc');
dtcEl.textContent = d.active_dtc;
+6
View File
@@ -55,6 +55,12 @@
<div class="invalid-feedback" data-error-for="device_name"></div>
<div class="form-text">Reserved for future server portal display.</div>
</div>
<div class="col-md-6">
<label class="form-label form-label-sm" for="odometer-baseline">Odometer baseline (km)</label>
<input class="form-control form-control-sm" id="odometer-baseline" type="number" inputmode="decimal" min="0" max="999999" step="0.1">
<div class="invalid-feedback" data-error-for="odometer_baseline"></div>
<div class="form-text">Enter your car's current odometer reading. The app adds trip distances to this baseline. Leave at 0 to use live OBD reading (not available on 2013 Yaris).</div>
</div>
</div>
<p class="text-muted small mb-0">Edit your device identity here. If server sync is enabled, these fields are read-only.</p>
</div>