diff --git a/application/libraries/Qra.php b/application/libraries/Qra.php index 49404c565..cd7f3e008 100644 --- a/application/libraries/Qra.php +++ b/application/libraries/Qra.php @@ -126,11 +126,21 @@ class Qra { return $echo; } - function getMaxDistanceQSO($mylocator, $qsos, $unit = "M") - { + /** + * Function to calculate the maximum distance in a bunch of QSOs + * + * @param string $mylocator Maidenhead locator of the station + * @param object $qsos Object of QSOs + * @param string $unit Unit of measurement + * + * @return object $maxdistanceqso Object of the QSO with the maximum distance + * @return integer $maxdistance Maximum distance + */ + + function getMaxDistanceQSO($mylocator, $qsos, $unit = "M") { //return nothing for empty QSO set if(count($qsos->result()) < 1){ - return [null, 0]; + return null; } //collect maximum data @@ -150,8 +160,12 @@ class Qra { } } + $result = []; + $result['qso'] = $maxdistanceqso; + $result['distance'] = intval($maxdistance); + //return findings - return [$maxdistanceqso, $maxdistance]; + return $result; } } diff --git a/application/libraries/Reg1testformat.php b/application/libraries/Reg1testformat.php index 6d4b9805f..cea5f4d7b 100644 --- a/application/libraries/Reg1testformat.php +++ b/application/libraries/Reg1testformat.php @@ -46,8 +46,8 @@ class Reg1testformat { $edi_header .= "CToSc=" . "\r\n"; //Argument describes the total claimed score. Leave empty. //set QSO info for QSO with max distance only if we can determine it - if($maxdistanceqso[0] != null){ - $edi_header .= "CODXC=" . strtoupper($maxdistanceqso[0]->COL_CALL) . ";" . substr(strtoupper($maxdistanceqso[0]->COL_GRIDSQUARE), 0, 6) . ";" . (int)$maxdistanceqso[1] . "\r\n"; //Arguments describe the claimed ODX contact call, WWL and distance. + if($maxdistanceqso['qso'] != null){ + $edi_header .= "CODXC=" . strtoupper($maxdistanceqso['qso']->COL_CALL) . ";" . substr(strtoupper($maxdistanceqso['qso']->COL_GRIDSQUARE), 0, 6) . ";" . $maxdistanceqso['distance'] . "\r\n"; //Arguments describe the claimed ODX contact call, WWL and distance. }else{ $edi_header .= "CODXC=" . "\r\n"; //Arguments describe the claimed ODX contact call, WWL and distance. Leave empty. }