diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-27 19:03:34 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-27 19:03:34 +0200 |
| commit | d7b93325d4f70eeab369fa8a3c4cce9f0c4e0081 (patch) | |
| tree | 76a913248fa04325e8e85f34df0cd03654e1ca76 /web/server_test.go | |
| parent | 558f755f5746a4ee819de87579951b7533688e5d (diff) | |
Add dual GPX/FIT exporter and backfill for rides
Phase 1 writes both .gpx and .fit on Strava import, adds fit_path
column, renames storage.gpx_dir to storage.rides_dir, and backfills
missing FIT files from existing GPX without breaking CLI progress.
FIT files are gitignored.
Diffstat (limited to 'web/server_test.go')
| -rw-r--r-- | web/server_test.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/web/server_test.go b/web/server_test.go index 7137031..e9444c7 100644 --- a/web/server_test.go +++ b/web/server_test.go @@ -53,6 +53,7 @@ type fakeSyncClient struct { type fakeSyncResult struct { activity strava.Activity data []byte + fitData []byte err error } @@ -60,12 +61,16 @@ func (c fakeSyncClient) List(time.Time, time.Time) ([]strava.Activity, error) { return c.activities, nil } -func (c fakeSyncClient) Get(id int64) (strava.Activity, []byte, error) { +func (c fakeSyncClient) Get(id int64) (strava.Activity, []byte, []byte, error) { result, ok := c.results[id] if !ok { - return strava.Activity{}, nil, fmt.Errorf("missing fake activity %d", id) + return strava.Activity{}, nil, nil, fmt.Errorf("missing fake activity %d", id) } - return result.activity, result.data, result.err + fitData := result.fitData + if fitData == nil && result.data != nil { + fitData = result.data + } + return result.activity, result.data, fitData, result.err } const emptyTrackGPX = `<?xml version="1.0"?><gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1"><trk><trkseg></trkseg></trk></gpx>` @@ -684,7 +689,7 @@ func (c countingSyncClient) List(from, to time.Time) ([]strava.Activity, error) return c.inner.List(from, to) } -func (c countingSyncClient) Get(id int64) (strava.Activity, []byte, error) { +func (c countingSyncClient) Get(id int64) (strava.Activity, []byte, []byte, error) { *c.getCalled = true return c.inner.Get(id) } |
