Skip to content

Commit 2a04110

Browse files
committed
set the exchange field names for the call history also when the call
history file changes
1 parent f592bc6 commit 2a04110

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

core/callhistory/callhistory.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,20 @@ func (f *Finder) FindEntry(s string) (core.AnnotatedCallsign, bool) {
136136
}
137137

138138
for _, entry := range entries {
139-
if entry.Key() == searchString {
140-
result, err := toAnnotatedCallsign(entry)
141-
if err != nil {
142-
log.Print(err)
143-
return core.AnnotatedCallsign{}, false
144-
}
145-
result.PredictedExchange = make([]string, len(f.fieldNames))
146-
for i := range f.fieldNames {
147-
result.PredictedExchange[i] = entry.Get(scp.FieldName(f.fieldNames[i]))
148-
}
149-
return result, true
139+
if entry.Key() != searchString {
140+
continue
141+
}
142+
143+
result, err := toAnnotatedCallsign(entry)
144+
if err != nil {
145+
log.Print(err)
146+
return core.AnnotatedCallsign{}, false
147+
}
148+
result.PredictedExchange = make([]string, len(f.fieldNames))
149+
for i := range f.fieldNames {
150+
result.PredictedExchange[i] = entry.Get(scp.FieldName(f.fieldNames[i]))
150151
}
152+
return result, true
151153
}
152154

153155
return core.AnnotatedCallsign{}, false
@@ -185,7 +187,7 @@ func toAnnotatedCallsign(match scp.Match) (core.AnnotatedCallsign, error) {
185187
Callsign: cs,
186188
Assembly: toMatchingAssembly(match),
187189
Comparable: match,
188-
Compare: func(a interface{}, b interface{}) bool {
190+
Compare: func(a any, b any) bool {
189191
aMatch, aOk := a.(scp.Match)
190192
bMatch, bOk := b.(scp.Match)
191193
if !aOk || !bOk {

core/settings/settings.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ func (s *Settings) SetOperationModeSprint(value bool) {
654654
func (s *Settings) EnterContestCallHistoryFile(value string) {
655655
s.contest.CallHistoryFilename = value
656656
s.callHistory.Activate(s.contest.CallHistoryFilename)
657+
s.callHistory.SelectFieldNames(s.contest.CallHistoryFieldNames)
657658
}
658659

659660
func (s *Settings) EnterContestCallHistoryFieldName(field core.EntryField, value string) {

0 commit comments

Comments
 (0)