From 81d309c582cf1bc74fae36f2e5b1fb0971b2d6ef Mon Sep 17 00:00:00 2001 From: Christian Beutel <> Date: Tue, 5 Nov 2024 01:23:06 +0100 Subject: [PATCH] finishes translation --- .../src/content/docs/guides/create-a-trail.md | 2 +- web/src/lib/components/base/calendar.svelte | 3 ++- .../summit_log/summit_log_card.svelte | 2 +- .../summit_log/summit_log_modal.svelte | 2 +- .../summit_log/summit_log_table_row.svelte | 2 +- web/src/lib/i18n/locales/de.json | 2 +- web/src/lib/util/format_util.ts | 4 ++-- web/src/routes/profile/+page.svelte | 19 +++++++++++++------ web/src/routes/profile/+page.ts | 10 ++++++---- 9 files changed, 28 insertions(+), 18 deletions(-) diff --git a/docs/src/content/docs/guides/create-a-trail.md b/docs/src/content/docs/guides/create-a-trail.md index a4235cb0..c9c7a37c 100644 --- a/docs/src/content/docs/guides/create-a-trail.md +++ b/docs/src/content/docs/guides/create-a-trail.md @@ -51,7 +51,7 @@ You can also add photos to the trail itself. If you add more than one photo you ### Summit book -If you do the same trail multiple times but do not want to create a new trail every time, you can simply make a new entry in the summit book to log the completion of the trail. +If you do the same trail multiple times but do not want to create a new trail every time, you can simply make a new entry in the summit book to log the completion of the trail. By default a new summit log entry is created automatically when you upload a fail containing GPS data in the trail creation process. For subsequent entries to the summit book you can provide an individual file containing your route data for this particular completion of the trail. ## Save the trail diff --git a/web/src/lib/components/base/calendar.svelte b/web/src/lib/components/base/calendar.svelte index 6de3ecd2..e79ac9f6 100644 --- a/web/src/lib/components/base/calendar.svelte +++ b/web/src/lib/components/base/calendar.svelte @@ -123,7 +123,8 @@ if (!date) { return; } - + console.log(date); + dispatch("click", date); } diff --git a/web/src/lib/components/summit_log/summit_log_card.svelte b/web/src/lib/components/summit_log/summit_log_card.svelte index aa40025a..dc699a9e 100644 --- a/web/src/lib/components/summit_log/summit_log_card.svelte +++ b/web/src/lib/components/summit_log/summit_log_card.svelte @@ -114,7 +114,7 @@ > {formatTimeHHMM( - log.duration, + log.duration ? log.duration / 60 : undefined, )} - {formatTimeHHMM(log.duration)} + {formatTimeHHMM(log.duration ? log.duration / 60 : undefined)} {#if showCategory} diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index 1273177e..c47fafec 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -19,7 +19,7 @@ "altitude": "Höhe", "api-documentation": "API Dokumentation", "avatar": "Avatar", - "average-speed": "Durschn. Geschwindigkeit", + "average-speed": "Durchschn. Geschwindigkeit", "basic-info": "Basisinformation", "before": "Vor", "can": "kann", diff --git a/web/src/lib/util/format_util.ts b/web/src/lib/util/format_util.ts index 82999284..ddd0134c 100644 --- a/web/src/lib/util/format_util.ts +++ b/web/src/lib/util/format_util.ts @@ -58,9 +58,9 @@ export function formatSpeed(speed?: number) { const unit = get(page).data.settings?.unit ?? "metric"; if (unit == "metric") { - return `${Math.round(speed)} km/h` + return `${(speed * 3.6).toFixed(2)} km/h` } else { - const mph = speed * 0.621371; + const mph = speed * 3.6 * 0.621371; return `${Math.round(mph)} mp/h`; } diff --git a/web/src/routes/profile/+page.svelte b/web/src/routes/profile/+page.svelte index e6ddf041..2c479202 100644 --- a/web/src/routes/profile/+page.svelte +++ b/web/src/routes/profile/+page.svelte @@ -123,7 +123,7 @@ switch (barChartSelectedValue) { case "duration": - return "min"; + return "h"; case "elevation_gain": case "elevation_loss": return unit == "metric" ? "m" : "ft"; @@ -144,6 +144,8 @@ (acc[date] || 0) + ((log as any)[barChartSelectedValue] ?? 0); if (barChartSelectedValue === "distance") { acc[date] = acc[date] / 1000; + }else if(barChartSelectedValue === "duration") { + acc[date] = acc[date] / 60 / 60; } if ($page.data.settings?.unit !== "metric") { acc[date] = @@ -193,7 +195,13 @@ ); $: averageSpeed = - totalDuration > 0 ? totalDistance / totalDuration : undefined; + totalDuration > 0 + ? $summitLogs.reduce( + (sum, log) => + sum + (log.distance && log.duration ? log.distance : 0), + 0, + ) / totalDuration + : undefined; function updateFilterCategory(categories: SelectItem[]) { filter.category = categories.map((c) => c.value); @@ -201,10 +209,10 @@ } function handleDateClick(date: Date) { - const datePlusN = new Date(); + const datePlusN = date; datePlusN.setDate(date.getDate() + 1); filter.startDate = datePlusN.toISOString().slice(0, 10); - datePlusN.setDate(date.getDate() + 2); + datePlusN.setDate(date.getDate() + 1); filter.endDate = datePlusN.toISOString().slice(0, 10); loadSummitLogs(); } @@ -219,7 +227,6 @@ {$_("profile")} | wanderer -
@@ -304,7 +311,7 @@ {$_("duration")} -

{formatTimeHHMM(totalDuration)}

+

{formatTimeHHMM(totalDuration / 60)}

{ - const date = new Date(), y = date.getFullYear(), m = date.getMonth(); - const firstDay = new Date(y, m, 1); - const lastDay = new Date(y, m + 1, 0); + const date = new Date() + date.setUTCHours(6) + const y = date.getFullYear() + const m = date.getMonth(); + const firstDay = new Date(y, m, 2); + const lastDay = new Date(y, m + 1, 1); const categories = await categories_index(fetch)