diff --git a/src/strava_offline/gpx.py b/src/strava_offline/gpx.py index b7dfe28..5f0b9b1 100644 --- a/src/strava_offline/gpx.py +++ b/src/strava_offline/gpx.py @@ -47,7 +47,7 @@ def download_gpx(strava: StravaWeb, activity_id: int, path: Path) -> None: def download_activities(db: sqlite3.Connection, strava: StravaWeb, dir_activities: Path) -> None: - for activity in db.execute("SELECT id FROM activity WHERE upload_id IS NOT NULL"): + for activity in db.execute("SELECT id FROM activity WHERE upload_id IS NOT NULL AND has_location_data"): activity_id = int(activity['id']) if find_gpx(dir_activities, activity_id): continue diff --git a/src/strava_offline/sqlite.py b/src/strava_offline/sqlite.py index c873a89..f94d1a1 100644 --- a/src/strava_offline/sqlite.py +++ b/src/strava_offline/sqlite.py @@ -35,7 +35,7 @@ def database(config: config.DatabaseConfig) -> Iterator[sqlite3.Connection]: # * sync_activity # # The tables will be recreated using the stored json data and the new schema. -SCHEMA_VERSION = 1 +SCHEMA_VERSION = 2 def schema_init(db: sqlite3.Connection) -> None: @@ -60,6 +60,7 @@ def schema_init(db: sqlite3.Connection) -> None: ", gear_id TEXT" ", type TEXT" ", commute BOOLEAN" + ", has_location_data BOOLEAN" ")" )) @@ -150,8 +151,9 @@ def sync_activity(activity, db: sqlite3.Connection): ", gear_id" ", type" ", commute" + ", has_location_data" ")" - "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" ), ( activity['id'], @@ -166,6 +168,7 @@ def sync_activity(activity, db: sqlite3.Connection): activity['gear_id'], activity['type'], activity['commute'], + activity['start_latlng'] is not None, ) )