Base LoTW matches on time and station_callsign

这个提交包含在:
phl0 2023-07-12 10:05:26 +02:00
父节点 bb682a0db3
当前提交 4ef2237ba4
找不到此签名对应的密钥
GPG 密钥 ID: 48EA1E640798CA9A
共有 2 个文件被更改,包括 9 次插入42 次删除

查看文件

@ -475,7 +475,6 @@ class Lotw extends CI_Controller {
$tableheaders .= "<td>IOTA</td>"; $tableheaders .= "<td>IOTA</td>";
$tableheaders .= "<td>Log Status</td>"; $tableheaders .= "<td>Log Status</td>";
$tableheaders .= "<td>LoTW Status</td>"; $tableheaders .= "<td>LoTW Status</td>";
$tableheaders .= "<td>Station ID</td>";
$tableheaders .= "</tr>"; $tableheaders .= "</tr>";
$table = ""; $table = "";
@ -503,16 +502,12 @@ class Lotw extends CI_Controller {
if($status[0] == "No Match" && $skipNewQso != NULL) { if($status[0] == "No Match" && $skipNewQso != NULL) {
$station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']); $result = $this->logbook_model->import($record, $station_id, NULL, TRUE, NULL, NULL, NULL, true, false); // Create the Entry
if ($result == "") {
if ($station_id != NULL) { $lotw_status = 'QSO imported';
$result = $this->logbook_model->import($record, $station_id, NULL, TRUE, NULL, NULL, NULL, true, false); // Create the Entry } else {
if ($result == "") { $lotw_status = $result;
$lotw_status = 'QSO imported'; }
} else {
$lotw_status = $result;
}
}
} else { } else {
if (isset($record['state'])) { if (isset($record['state'])) {
@ -551,12 +546,7 @@ class Lotw extends CI_Controller {
$ituz = ""; $ituz = "";
} }
$station_id = $this->logbook_model->find_correct_station_id($record['station_callsign'], $record['my_gridsquare']); $lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $record['station_callsign']);
if ($station_id != NULL) {
$lotw_status = $this->logbook_model->lotw_update($time_on, $record['call'], $record['band'], $qsl_date, $record['qsl_rcvd'], $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id);
} else {
$lotw_status = "No matching Grid/OP-Call (check Locations)";
}
} }
@ -572,7 +562,6 @@ class Lotw extends CI_Controller {
$table .= "<td>".$iota."</td>"; $table .= "<td>".$iota."</td>";
$table .= "<td>QSO Record: ".$status[0]."</td>"; $table .= "<td>QSO Record: ".$status[0]."</td>";
$table .= "<td>LoTW Record: ".$lotw_status."</td>"; $table .= "<td>LoTW Record: ".$lotw_status."</td>";
$table .= "<td>".$station_id."</td>";
$table .= "</tr>"; $table .= "</tr>";
} }

查看文件

@ -2636,7 +2636,7 @@ class Logbook_model extends CI_Model {
} }
} }
function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_id) { function lotw_update($datetime, $callsign, $band, $qsl_date, $qsl_status, $state, $qsl_gridsquare, $iota, $cnty, $cqz, $ituz, $station_callsign) {
$data = array( $data = array(
'COL_LOTW_QSLRDATE' => $qsl_date, 'COL_LOTW_QSLRDATE' => $qsl_date,
@ -2665,7 +2665,7 @@ class Logbook_model extends CI_Model {
$this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"'); $this->db->where('date_format(COL_TIME_ON, \'%Y-%m-%d %H:%i\') = "'.$datetime.'"');
$this->db->where('COL_CALL', $callsign); $this->db->where('COL_CALL', $callsign);
$this->db->where('COL_BAND', $band); $this->db->where('COL_BAND', $band);
$this->db->where('station_id', $station_id); $this->db->where('COL_STATION_CALLSIGN', $station_callsign);
$this->db->update($this->config->item('table_name'), $data); $this->db->update($this->config->item('table_name'), $data);
unset($data); unset($data);
@ -3922,28 +3922,6 @@ class Logbook_model extends CI_Model {
return $query->result(); return $query->result();
} }
/*
* This function tries to locate the correct station_id used for importing QSOs from the downloaded LoTWreport
* $station_callsign is the call listed for the qso in lotwreport
* $my_gridsquare is the gridsquare listed for the qso in lotwreport
* Returns station_id if found
*/
function find_correct_station_id($station_callsign, $my_gridsquare) {
$sql = 'select station_id from station_profile
where station_callsign = "' . $station_callsign . '" and station_gridsquare = "' .$my_gridsquare. '"';
$query = $this->db->query($sql);
$result = $query->row();
if ($result) {
return $result->station_id;
}
else {
return null;
}
}
function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) { function get_lotw_qsos_to_upload($station_id, $start_date, $end_date) {
$this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id'); $this->db->select('COL_PRIMARY_KEY,COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id');