Removed LIMIT from query, added Date checks for LOTW QSO upload

pull/594/head
Peter Goodhall 2020-09-02 11:22:08 +01:00
rodzic 24719a6b99
commit 9bce835377
2 zmienionych plików z 6 dodań i 4 usunięć

Wyświetl plik

@ -187,7 +187,7 @@ class Lotw extends CI_Controller {
$this->load->model('Logbook_model');
$data['qsos'] = $this->Logbook_model->get_lotw_qsos_to_upload($data['station_profile']->station_id);
$data['qsos'] = $this->Logbook_model->get_lotw_qsos_to_upload($data['station_profile']->station_id, $data['lotw_cert_info']->date_created, $data['lotw_cert_info']->date_expires);
foreach ($data['qsos']->result() as $temp_qso) {
array_push($qso_id_array, $temp_qso->COL_PRIMARY_KEY);

Wyświetl plik

@ -2210,15 +2210,17 @@ class Logbook_model extends CI_Model {
}
}
function get_lotw_qsos_to_upload($station_id) {
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_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE, COL_LOTW_QSL_SENT, station_id');
$this->db->where("station_id", 1);
$this->db->where("station_id", $station_id);
$this->db->where('COL_LOTW_QSL_SENT !=', "Y");
$this->db->where('COL_PROP_MODE !=', "INTERNET");
$this->db->where('COL_TIME_ON >=', $start_date);
$this->db->where('COL_TIME_ON <=', $end_date);
$this->db->order_by("COL_TIME_ON", "desc");
$this->db->limit(1);
$query = $this->db->get($this->config->item('table_name'));
return $query;