ingest activities.csv
This commit is contained in:
@@ -275,8 +275,8 @@ try {
|
||||
id="upload-drop"
|
||||
class="border-2 border-dashed border-zinc-700 rounded-lg p-8 text-center text-zinc-500 text-sm cursor-pointer hover:border-zinc-500 hover:text-zinc-300 transition-colors"
|
||||
>
|
||||
<div id="upload-label">Drop FIT, GPX, or TCX files<br/>or click to browse</div>
|
||||
<input id="upload-input" type="file" accept=".fit,.gpx,.tcx,.fit.gz,.gpx.gz,.tcx.gz" class="hidden" multiple />
|
||||
<div id="upload-label">Drop FIT, GPX, TCX, or activities.csv<br/>or click to browse</div>
|
||||
<input id="upload-input" type="file" accept=".fit,.gpx,.tcx,.fit.gz,.gpx.gz,.tcx.gz,.csv" class="hidden" multiple />
|
||||
</div>
|
||||
<label class="flex items-start gap-2 mt-3 cursor-pointer group">
|
||||
<input
|
||||
@@ -525,12 +525,16 @@ try {
|
||||
const d = await r.json();
|
||||
const dupes = d.results.filter(r => r.error === 'duplicate').length;
|
||||
const errors = d.results.filter(r => !r.ok && r.error !== 'duplicate').length;
|
||||
let msg = `${d.added} added`;
|
||||
if (dupes) msg += `, ${dupes} duplicate${dupes > 1 ? 's' : ''}`;
|
||||
if (errors) msg += `, ${errors} failed`;
|
||||
fileStatus.textContent = msg;
|
||||
fileStatus.style.color = d.added > 0 ? '#4ade80' : '#a1a1aa';
|
||||
if (d.added > 0) setTimeout(() => { window.location.reload(); }, 1200);
|
||||
const parts = [];
|
||||
if (d.added > 0) parts.push(`${d.added} added`);
|
||||
if (d.csv_updates > 0) parts.push(`${d.csv_updates} updated from CSV`);
|
||||
if (dupes) parts.push(`${dupes} duplicate${dupes > 1 ? 's' : ''}`);
|
||||
if (errors) parts.push(`${errors} failed`);
|
||||
if (parts.length === 0) parts.push('nothing to add');
|
||||
fileStatus.textContent = parts.join(', ');
|
||||
const anyGood = d.added > 0 || d.csv_updates > 0;
|
||||
fileStatus.style.color = anyGood ? '#4ade80' : '#a1a1aa';
|
||||
if (anyGood) setTimeout(() => { window.location.reload(); }, 1200);
|
||||
else drop.style.pointerEvents = '';
|
||||
} catch (e) {
|
||||
fileStatus.textContent = 'Error: ' + e.message;
|
||||
|
||||
Reference in New Issue
Block a user