Skip to content

Commit

Permalink
Fixed bug when comparing an uppercase with an lowercase QTH locator
Browse files Browse the repository at this point in the history
  • Loading branch information
ciorceri committed Sep 6, 2018
1 parent 1b80544 commit ab759fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions edi.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,13 +976,13 @@ def compare_qso(log1, qso1, log2, qso2):
raise ValueError('Serial number mismatch')

# compare qth
if log1.maidenhead_locator != qso2.qso_fields['wwl']:
if log1.maidenhead_locator.upper() != qso2.qso_fields['wwl'].upper():
raise ValueError('Qth locator mismatch (other ham)')
if log2.maidenhead_locator != qso1.qso_fields['wwl']:
if log2.maidenhead_locator.upper() != qso1.qso_fields['wwl'].upper():
raise ValueError('Qth locator mismatch')

# calculate & return distance
return qth_distance(log1.maidenhead_locator, log2.maidenhead_locator)
return qth_distance(log1.maidenhead_locator.upper(), log2.maidenhead_locator.upper())


def mark_older_logs(log_list):
Expand Down
5 changes: 5 additions & 0 deletions test_edi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,6 +1054,8 @@ def test_compare_qso(self, mock_isfile):
edi.LogQso('130803;1200;YO5AAA;6;59;001;59;001;;ZZ16ZZ;1;;;;', 1, _rules),
# qso with long serial (29)
edi.LogQso('130803;1200;YO5AAA;6;59;0001;59;001;;KN16AA;1;;;;', 1, _rules),
# qso with lowercase qthlocator (30)
edi.LogQso('130803;1200;YO5AAA;6;59;0001;59;001;;KN16aa;1;;;;', 1, _rules),
]

qso_test = (
Expand Down Expand Up @@ -1130,6 +1132,9 @@ def test_compare_qso(self, mock_isfile):
# valid test with long serial
(qso_list[0], qso_list[29], 1, None, None),
(qso_list[29], qso_list[0], 1, None, None),
# valid test with lowercase qthlocator
(qso_list[0], qso_list[30], 1, None, None),
(qso_list[30], qso_list[0], 1, None, None),

)

Expand Down

0 comments on commit ab759fd

Please sign in to comment.