This commit is contained in:
2024-11-13 09:19:43 +07:00
parent 10f936838f
commit e99a0a921d
7 changed files with 127 additions and 17 deletions

24
xml.go
View File

@ -115,19 +115,25 @@ func GetDXCC(dxCall string, Countries Countries) string {
}
}
DXCCMatch := DXCCList[0]
higherMatch := DXCCList[0].RegExCharacters
if len(DXCCList) > 0 {
DXCCMatch := DXCCList[0]
higherMatch := 0
if len(DXCCList) > 1 {
for i := 0; i < len(DXCCList); i++ {
if DXCCList[i].RegExCharacters > higherMatch && !DXCCList[i].Ended {
DXCCMatch = DXCCList[i]
higherMatch = DXCCList[i].RegExCharacters
if len(DXCCList) > 1 {
for i := 0; i < len(DXCCList); i++ {
if DXCCList[i].RegExCharacters > higherMatch && !DXCCList[i].Ended {
DXCCMatch = DXCCList[i]
higherMatch = DXCCList[i].RegExCharacters
}
}
} else {
DXCCMatch = DXCCList[0]
}
return DXCCMatch.DXCC
} else {
DXCCMatch = DXCCList[0]
Log.Errorf("Could not find %s in country list", dxCall)
}
return DXCCMatch.DXCC
return ""
}