changed to db for fit streams

This commit is contained in:
2026-01-14 05:39:16 -08:00
parent 362f4cb5aa
commit 45dbc32295
99 changed files with 2118 additions and 1684 deletions

View File

@@ -6,28 +6,11 @@
<div class="row g-3 align-items-center mb-3">
<div class="col-auto">
<div class="btn-group" role="group">
<button class="btn btn-primary" id="scan-30-btn">
<i class="bi bi-search"></i> Scan for New (30d)
</button>
<button class="btn btn-outline-primary" id="scan-all-btn">
<i class="bi bi-search-heart"></i> Scan All History
</button>
<button class="btn btn-outline-primary" id="sync-10-btn">
<i class="bi bi-cloud-download"></i> Sync 10 Pending
</button>
<button class="btn btn-outline-primary" id="sync-all-btn">
<i class="bi bi-cloud-download-fill"></i> Sync All Pending
</button>
<button class="btn btn-outline-success" id="match-bikes-btn">
<i class="bi bi-bicycle"></i> Match Bikes
</button>
</div>
</div>
<div class="col-auto">
<span class="badge bg-info" id="status-new">New: 0</span>
<span class="badge bg-warning text-dark" id="status-updated">Updated: 0</span>
<span class="badge bg-success" id="status-synced">Synced: 0</span>
</div>
</div>
<div class="row g-3 align-items-center">
<div class="col-auto">
@@ -419,15 +402,8 @@
document.getElementById('download-selected-btn').addEventListener('click', downloadSelected);
document.getElementById('redownload-selected-btn').addEventListener('click', redownloadSelected);
document.getElementById('scan-30-btn').addEventListener('click', () => scanActivities(30));
document.getElementById('scan-all-btn').addEventListener('click', () => scanActivities(3650));
document.getElementById('sync-10-btn').addEventListener('click', () => syncPending(10));
document.getElementById('sync-all-btn').addEventListener('click', () => syncPending(null));
document.getElementById('sync-all-btn').addEventListener('click', () => syncPending(null));
document.getElementById('match-bikes-btn').addEventListener('click', triggerBikeMatching);
updateSyncStatus();
});
// ... Helpers same as before ...
@@ -617,17 +593,7 @@
loadActivities();
}
async function updateSyncStatus() {
try {
const res = await fetch('/api/activities/sync/status');
if (res.ok) {
const data = await res.json();
document.getElementById('status-new').textContent = `New: ${data.new || 0}`;
document.getElementById('status-updated').textContent = `Updated: ${data.updated || 0}`;
document.getElementById('status-synced').textContent = `Synced: ${data.synced || 0}`;
}
} catch (e) { }
}
async function scanActivities(daysBack) {
showToast("Scanning...", `Starting scan...`, "info");
@@ -655,21 +621,7 @@
} catch (e) { showToast("Error", e.message, "error"); }
}
async function triggerBikeMatching() {
showToast("Matching...", "Starting bike match process...", "info");
try {
const res = await fetch('/api/bike-setups/match-all', { method: 'POST' });
const data = await res.json();
if (res.ok) {
showToast("Success", data.message, "success");
loadActivities();
} else {
throw new Error("Failed");
}
} catch (e) {
showToast("Error", "Matching failed", "error");
}
}
async function fetchBikeSetups() {
try {