Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.3-develop' into 5.3-develop
Browse files Browse the repository at this point in the history
  • Loading branch information
brookgagnon committed Nov 13, 2024
2 parents 725b58f + a1194ab commit 3a4c00a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
23 changes: 19 additions & 4 deletions ui/fields/coordinates.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,19 @@ class OBFieldCoordinates extends OBField {
}

renderView() {
if (this._lat != null && this._lng != null) {
render(html` <div>${this._lat}, ${this._lng}</div> `, 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` <div>${lat}, ${lng}</div> `, this.root);
} else {
render(html` <div></div> `, this.root);
}
Expand Down Expand Up @@ -85,15 +96,19 @@ 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();
}

_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();
Expand Down
9 changes: 6 additions & 3 deletions updates/20230613.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3a4c00a

Please sign in to comment.