From 4d1dd75c9dab346c65b4d7933d953529051f075e Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Fri, 5 Jan 2024 19:37:04 +0100 Subject: [PATCH] biking is not walking. --- index.mjs | 2 +- lib/tcx.mjs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.mjs b/index.mjs index 04cb369..717d835 100644 --- a/index.mjs +++ b/index.mjs @@ -54,7 +54,7 @@ async function main() { console.log("Going ahead with", act.activityId, act.activityType.typeKey) await garmin.downloadOriginalActivityData(act, "/tmp/", "tcx") - const input = await generateTrimlogInput(`/tmp/${act.activityId}.tcx`, act.activityName) + const input = await generateTrimlogInput(`/tmp/${act.activityId}.tcx`, act.activityName, act.activityType?.typeKey) input.tags.push({key: "gc:ActivityID", value: id}) diff --git a/lib/tcx.mjs b/lib/tcx.mjs index 53c8448..cd4071e 100644 --- a/lib/tcx.mjs +++ b/lib/tcx.mjs @@ -1,7 +1,7 @@ import * as fs from "fs/promises"; import { parseString } from "xml2js"; -export function generateTrimlogInput(filename, name = "Walk") { +export function generateTrimlogInput(filename, name = "Walk", type = "walk") { return new Promise(async(resolve, reject) => { parseString(await fs.readFile(filename, "utf-8"), (err, res) => { if (err != null) { @@ -45,7 +45,7 @@ export function generateTrimlogInput(filename, name = "Walk") { const out = { date: dateStr, contents: [{rawActivity: { - kind: "Walking", + kind: type === "cycling" ? "Biking" : "Walking", sets: [], effortScale: 1, weight: 0,