From 1acfa21d19723ee9a541f362740fd7cbb8de043f Mon Sep 17 00:00:00 2001 From: phl0 Date: Mon, 19 Jan 2026 08:26:26 +0100 Subject: [PATCH] Handle (new) satellites without LoTW name correctly --- application/controllers/Satellite.php | 4 ++-- application/models/Satellite_model.php | 6 ++++-- application/views/satellite/flightpath.php | 2 +- application/views/satellite/index.php | 4 ++-- application/views/satellite/pass.php | 2 +- application/views/satellite/passtable.php | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/application/controllers/Satellite.php b/application/controllers/Satellite.php index 129669559..0d4a0e3fe 100644 --- a/application/controllers/Satellite.php +++ b/application/controllers/Satellite.php @@ -383,7 +383,7 @@ class Satellite extends CI_Controller { $satellites = $this->satellite_model->get_all_satellites_with_tle(); foreach ($satellites as $sat) { // Loop through known SATs if ( (count($input_sat) > 0) && !((count($input_sat) == 1) && (($input_sat[0] ?? '') == '')) ) { // User wants specific SATs (which isn't "All" or empty)?? - if (in_array($sat->satname,$input_sat)) { + if (in_array($sat->satname,$input_sat) || in_array($sat->displayname,$input_sat)) { $tles[]=$this->satellite_model->get_tle($sat->satname); } else { continue; @@ -437,7 +437,7 @@ class Satellite extends CI_Controller { try { $temp = preg_split('/\n/', $sat_tle->tle); - $tle = new Predict_TLE($sat_tle->satellite, $temp[0], $temp[1]); // Instantiate it + $tle = new Predict_TLE(($sat_tle->satellite ? $sat_tle->satellite : $sat_tle->displayname), $temp[0], $temp[1]); // Instantiate it $sat = new Predict_Sat($tle); // Load up the satellite data $now = $this->get_daynum_from_date($date)+($mintime/24); // get the current time as Julian Date (daynum) diff --git a/application/models/Satellite_model.php b/application/models/Satellite_model.php index 46a7d0784..7ca58c036 100644 --- a/application/models/Satellite_model.php +++ b/application/models/Satellite_model.php @@ -14,13 +14,14 @@ class Satellite_model extends CI_Model { function get_satellite_information($satname = null) { $bindings = []; - $sql = "select satellite.id, satellite.name as satname, satellitemode.name as modename, satellite.displayname, satellite.orbit, satellite.lotw as lotw, tle.updated, satellitemode.uplink_mode, satellitemode.downlink_mode, FORMAT((satellitemode.uplink_freq / 1000000), 3) AS uplink_freq, FORMAT((satellitemode.downlink_freq / 1000000), 3) AS downlink_freq + $sql = "select satellite.id, coalesce(nullif(satellite.name, ''), satellite.displayname) as satname, satellitemode.name as modename, satellite.displayname, satellite.orbit, satellite.lotw as lotw, tle.updated, satellitemode.uplink_mode, satellitemode.downlink_mode, FORMAT((satellitemode.uplink_freq / 1000000), 3) AS uplink_freq, FORMAT((satellitemode.downlink_freq / 1000000), 3) AS downlink_freq from satellite left outer join satellitemode on satellite.id = satellitemode.satelliteid left outer join tle on satellite.id = tle.satelliteid "; if ($satname != null) { - $sql .= " where satellite.name = ? "; + $sql .= " where satellite.name = ? or satellite.displayname = ?"; + $bindings[] = $satname; $bindings[] = $satname; } @@ -193,6 +194,7 @@ class Satellite_model extends CI_Model { $this->db->select('satellite.name AS satellite, satellite.displayname AS displayname, tle.tle, tle.updated'); $this->db->join('tle', 'satellite.id = tle.satelliteid'); $this->db->where('name', $sat); + $this->db->or_where('displayname', $sat); $query = $this->db->get('satellite'); return $query->row(); } diff --git a/application/views/satellite/flightpath.php b/application/views/satellite/flightpath.php index aad4b619a..4077d687a 100644 --- a/application/views/satellite/flightpath.php +++ b/application/views/satellite/flightpath.php @@ -40,7 +40,7 @@ - + diff --git a/application/views/satellite/passtable.php b/application/views/satellite/passtable.php index ba0ab146d..636120148 100644 --- a/application/views/satellite/passtable.php +++ b/application/views/satellite/passtable.php @@ -28,7 +28,7 @@ if (isset($filtered)) { $tca=sat2pol($max_el_az,$max_el,$scale); $control = array(2 * $tca[0] - ($aos[0] + $los[0]) / 2, 2 * $tca[1] - ($aos[1] + $los[1]) / 2); // Calc Controlpoints for Bezier-Curve echo ''; - echo '' . $pass->satname . ' '; + echo '' . ($pass->satname != '' ? $pass->satname : $pass->displayname) . ' '; echo '' . Predict_Time::daynum2readable($pass->aos, $zone, $format) . ''; echo '' . Predict_Time::daynum2readable($pass->los, $zone, $format) . ''; echo '' . returntimediff(Predict_Time::daynum2readable($pass->aos, $zone, $format), Predict_Time::daynum2readable($pass->los, $zone, $format), $format) . '';