From: Philipp Spitzer Date: Sun, 17 Dec 2023 10:25:04 +0000 (+0100) Subject: Add length column to sledrun list. X-Git-Url: https://git.toastfreeware.priv.at/philipp/winterrodeln/wrpylib.git/commitdiff_plain/e28c4b27d4a08130d3922c4f391676a1d18c5b76 Add length column to sledrun list. --- diff --git a/scripts/query_sledrun_list.py b/scripts/query_sledrun_list.py index e4ac49e..ca39346 100644 --- a/scripts/query_sledrun_list.py +++ b/scripts/query_sledrun_list.py @@ -51,6 +51,7 @@ def create_sledrun_list(connection: Connection, api_url: str): "JSON_EXTRACT(sledrun_json, '$.name') as name, " \ "JSON_EXTRACT(sledrun_json, '$.position.longitude') as latitude, " \ "JSON_EXTRACT(sledrun_json, '$.position.latitude') as longitude, " \ + "JSON_EXTRACT(sledrun_json, '$.length') as length, " \ "JSON_EXTRACT(sledrun_json, '$.entry_under_construction') as under_construction, " \ "page_title as title " \ "FROM wrsledrunjsoncache JOIN page ON sledrun_page_id=page_id " \ @@ -58,11 +59,11 @@ def create_sledrun_list(connection: Connection, api_url: str): rows = connection.execute(sql) writer = csv.writer(sys.stdout, lineterminator='\n') - writer.writerow(['Name', 'Longitude', 'Latitude', 'InArbeit', 'Url']) + writer.writerow(['Name', 'Length', 'Longitude', 'Latitude', 'InArbeit', 'Url']) for row in rows: title = row['title'].decode('utf-8') url = urllib.parse.urljoin(api_url, title) - writer.writerow([json.loads(row['name']), row['latitude'], row['longitude'], row['under_construction'], url]) + writer.writerow([json.loads(row['name']), row['length'], row['latitude'], row['longitude'], row['under_construction'], url]) def query_sledrun_list(inifiles: List[str]):