From 3315d85c5252469f213908765ea2933c778a7795 Mon Sep 17 00:00:00 2001 From: Postkassi <88798194+Postkassi@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:30:50 +0000 Subject: [PATCH 1/2] Fix for update 20230613.php Had an issue that was affecting the database update for mysql, current code is specific to mariadb. Updated code should work for both mysql and mariadb. --- updates/20230613.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/updates/20230613.php b/updates/20230613.php index 55e577d2..7c0e2400 100644 --- a/updates/20230613.php +++ b/updates/20230613.php @@ -16,9 +16,12 @@ public function items() public function run() { // Add a file location column to playlists to use when storing thumbnails. - $this->db->query('ALTER TABLE `playlists` ADD COLUMN IF NOT EXISTS `file_location` VARCHAR(2) NOT NULL AFTER `name`;'); - if ($this->db->error()) { - return false; + if (! $this->db->column_exists('playlists', 'file_location')) { + $this->db->query('ALTER TABLE `playlists` ADD COLUMN `file_location` VARCHAR(2) NOT NULL AFTER `name`;'); + if ($this->db->error()) { + echo $this->db->error(); //Debug output + return false; + } } // Add a random location to all previously existing playlists and create their directories. From ac0eb77f7c7fed11ff861542de3328ed29be7ea5 Mon Sep 17 00:00:00 2001 From: Brook Gagnon Date: Thu, 24 Oct 2024 18:18:37 +0000 Subject: [PATCH 2/2] coordinates field fixes --- ui/fields/coordinates.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/ui/fields/coordinates.js b/ui/fields/coordinates.js index 9ea572a6..864430f8 100644 --- a/ui/fields/coordinates.js +++ b/ui/fields/coordinates.js @@ -44,8 +44,19 @@ class OBFieldCoordinates extends OBField { } renderView() { - if (this._lat != null && this._lng != null) { - render(html`
${this._lat}, ${this._lng}
`, this.root); + let lat = null; + let lng = null; + + if (this._lat != null) { + lat = parseFloat(this._lat).toFixed(5); + } + + if (this._lng != null) { + lng = parseFloat(this._lng).toFixed(5); + } + + if (lat != null && lat != null) { + render(html`
${lat}, ${lng}
`, this.root); } else { render(html`
`, this.root); } @@ -85,7 +96,9 @@ class OBFieldCoordinates extends OBField { _updateLat(event) { const lat = parseFloat(event.target.value); - if (lat >= -90 && lat <= 90) { + if (isNaN(lat)) { + this._lat = null; + } else if (lat >= -90 && lat <= 90) { this._lat = lat; } this.refresh(); @@ -93,7 +106,9 @@ class OBFieldCoordinates extends OBField { _updateLng(event) { const lng = event.target.value; - if (lng >= -180 && lng <= 180) { + if (isNaN(lng)) { + this._lng = null; + } else if (lng >= -180 && lng <= 180) { this._lng = lng; } this.refresh();