diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8cf36809..65a8086c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,14 @@
-
+# v0.10.1
+## Features
+- Adds elevation loss to trails. Please note that trails created before this version will have a default elevation loss of 0. Edit & save to update.
+
+## Bug fixes
+- Fixes bug that caused auto-added summit logs to not have distance, durtaion etc.
+- Fixes error in the auto-upload feature
+- Fixes access permissions for profile page
+- A summit log is now also created automatically when you upload a trail directly
+- Fixes link to the API documentation in footer
+
# v0.10.0
## Features
- A new summit log entry is now added automatically when uploading a new GPX file for a new or existing trail
diff --git a/db/migrations/1731151547_updated_trails.go b/db/migrations/1731151547_updated_trails.go
new file mode 100644
index 00000000..ae43afae
--- /dev/null
+++ b/db/migrations/1731151547_updated_trails.go
@@ -0,0 +1,55 @@
+package migrations
+
+import (
+ "encoding/json"
+
+ "github.com/pocketbase/dbx"
+ "github.com/pocketbase/pocketbase/daos"
+ m "github.com/pocketbase/pocketbase/migrations"
+ "github.com/pocketbase/pocketbase/models/schema"
+)
+
+func init() {
+ m.Register(func(db dbx.Builder) error {
+ dao := daos.New(db);
+
+ collection, err := dao.FindCollectionByNameOrId("e864strfxo14pm4")
+ if err != nil {
+ return err
+ }
+
+ // add
+ new_elevation_loss := &schema.SchemaField{}
+ if err := json.Unmarshal([]byte(`{
+ "system": false,
+ "id": "xutbwpq4",
+ "name": "elevation_loss",
+ "type": "number",
+ "required": false,
+ "presentable": false,
+ "unique": false,
+ "options": {
+ "min": null,
+ "max": null,
+ "noDecimal": false
+ }
+ }`), new_elevation_loss); err != nil {
+ return err
+ }
+ collection.Schema.AddField(new_elevation_loss)
+
+ return dao.SaveCollection(collection)
+ }, func(db dbx.Builder) error {
+ dao := daos.New(db);
+
+ collection, err := dao.FindCollectionByNameOrId("e864strfxo14pm4")
+ if err != nil {
+ return err
+ }
+
+ // remove
+ collection.Schema.RemoveField("xutbwpq4")
+
+ return dao.SaveCollection(collection)
+ })
+}
diff --git a/web/src/lib/components/base/calendar.svelte b/web/src/lib/components/base/calendar.svelte
index 6cb6aced..95c0f352 100644
--- a/web/src/lib/components/base/calendar.svelte
+++ b/web/src/lib/components/base/calendar.svelte
@@ -114,7 +114,7 @@
function colorKey(i: number) {
return $_(
- currentMonthArray[i]?.log?.expand.trails_via_summit_logs?.at(0)
+ currentMonthArray[i]?.log?.expand?.trails_via_summit_logs?.at(0)
?.expand?.category?.name ?? "",
);
}
diff --git a/web/src/lib/components/summit_log/summit_log_table_row.svelte b/web/src/lib/components/summit_log/summit_log_table_row.svelte
index a217aeb2..c8175f7c 100644
--- a/web/src/lib/components/summit_log/summit_log_table_row.svelte
+++ b/web/src/lib/components/summit_log/summit_log_table_row.svelte
@@ -80,11 +80,11 @@
type="button"
on:click={openMap}
class="h-20 aspect-square shrink-0 rounded-xl !bg-background hover:!bg-secondary-hover transition-colors"
- class:hidden={!log.expand.gpx_data}
+ class:hidden={!log.expand?.gpx_data}
id="mini-map-{index}"
>
-
{new Date(log.date).toLocaleDateString(undefined, {
month: "2-digit",
day: "2-digit",
@@ -108,7 +108,7 @@
{#if showCategory}
|
{$_(
- log.expand.trails_via_summit_logs?.at(0)?.expand.category
+ log.expand?.trails_via_summit_logs?.at(0)?.expand?.category
?.name ?? "-",
)}
|
@@ -117,7 +117,7 @@
diff --git a/web/src/lib/components/trail/trail_card.svelte b/web/src/lib/components/trail/trail_card.svelte
index 2d03665c..51bdd0bc 100644
--- a/web/src/lib/components/trail/trail_card.svelte
+++ b/web/src/lib/components/trail/trail_card.svelte
@@ -75,20 +75,25 @@
-
+
{formatDistance(
trail.distance,
)}
{formatElevation(
+ >{formatTimeHHMM(
+ trail.duration,
+ )}
+ {formatElevation(
trail.elevation_gain,
)}
{formatTimeHHMM(
- trail.duration,
+ >{formatElevation(
+ trail.elevation_loss,
)}
diff --git a/web/src/lib/components/trail/trail_info_panel.svelte b/web/src/lib/components/trail/trail_info_panel.svelte
index e57684ab..9dd55a1e 100644
--- a/web/src/lib/components/trail/trail_info_panel.svelte
+++ b/web/src/lib/components/trail/trail_info_panel.svelte
@@ -246,7 +246,7 @@
{#if mode == "overview"}
diff --git a/web/src/lib/models/summit_log.ts b/web/src/lib/models/summit_log.ts
index fa6cb435..5ac75443 100644
--- a/web/src/lib/models/summit_log.ts
+++ b/web/src/lib/models/summit_log.ts
@@ -5,7 +5,7 @@ class SummitLog {
date: string;
text?: string;
gpx?: string;
- _gpx: File | Blob | null;
+ _gpx: File | null;
distance?: number
elevation_gain?: number
elevation_loss?: number
@@ -17,11 +17,15 @@ class SummitLog {
trails_via_summit_logs?: Trail[];
}
- constructor(date: string, params?: { id?: string, text?: string }) {
+ constructor(date: string, params?: { id?: string, text?: string, distance?: number, elevation_loss?: number, elevation_gain?: number, duration?: number }) {
this.date = date;
this.id = params?.id;
this.text = params?.text ?? "";
this.expand = {}
+ this.distance = params?.distance
+ this.elevation_gain = params?.elevation_gain
+ this.elevation_loss = params?.elevation_loss
+ this.duration = params?.duration
this._gpx = null
}
}
diff --git a/web/src/lib/models/trail.ts b/web/src/lib/models/trail.ts
index f850577c..3c8ccf65 100644
--- a/web/src/lib/models/trail.ts
+++ b/web/src/lib/models/trail.ts
@@ -12,6 +12,7 @@ class Trail {
public: boolean;
distance?: number;
elevation_gain?: number;
+ elevation_loss?: number;
duration?: number;
difficulty?: "easy" | "moderate" | "difficult"
lat?: number;
@@ -43,6 +44,7 @@ class Trail {
public?: boolean,
distance?: number,
elevation_gain?: number,
+ elevation_loss?: number,
duration?: number,
difficulty?: "easy" | "moderate" | "difficult",
lat?: number,
@@ -68,6 +70,7 @@ class Trail {
this.public = params?.public ?? false
this.distance = params?.distance;
this.elevation_gain = params?.elevation_gain;
+ this.elevation_loss = params?.elevation_loss;
this.duration = params?.duration;
this.difficulty = params?.difficulty ?? "easy";
this.lat = params?.lat;
diff --git a/web/src/lib/util/gpx_util.ts b/web/src/lib/util/gpx_util.ts
index 1a5351ea..24c34570 100644
--- a/web/src/lib/util/gpx_util.ts
+++ b/web/src/lib/util/gpx_util.ts
@@ -58,6 +58,7 @@ export async function gpx2trail(gpxString: string, fallbackName?: string) {
trail.duration = totals.duration / 1000 / 60
trail.elevation_gain = totals.elevationGain;
+ trail.elevation_loss = totals.elevationLoss;
trail.distance = totals.distance
return { gpx: gpx, trail: trail }
diff --git a/web/src/routes/profile/+page.svelte b/web/src/routes/profile/+page.svelte
index 8e96368c..88213682 100644
--- a/web/src/routes/profile/+page.svelte
+++ b/web/src/routes/profile/+page.svelte
@@ -91,7 +91,7 @@
$: logCategories = $summitLogs.reduce(
(acc, log) => {
const cat =
- log.expand.trails_via_summit_logs?.at(0)?.expand.category
+ log.expand?.trails_via_summit_logs?.at(0)?.expand?.category
?.name ?? "unknown";
acc[$_(cat)] = (acc[$_(cat)] || 0) + 1;
return acc;
|