feat: Award column can now show either reference or description
This commit is contained in:
@@ -2906,8 +2906,10 @@ func (a *App) AwardRefsForQSOs(ids []int64) (map[int64]map[string]string, error)
|
||||
defs := a.awardDefs()
|
||||
metas := a.awardRefMetas(defs)
|
||||
fieldByCode := map[string]string{}
|
||||
dispByCode := map[string]string{}
|
||||
for _, d := range defs {
|
||||
fieldByCode[strings.ToUpper(d.Code)] = strings.ToLower(strings.TrimSpace(d.Field))
|
||||
dispByCode[strings.ToUpper(d.Code)] = strings.ToLower(strings.TrimSpace(d.RefDisplay))
|
||||
}
|
||||
nameOf := func(field, ref string) string {
|
||||
switch field {
|
||||
@@ -2933,10 +2935,22 @@ func (a *App) AwardRefsForQSOs(ids []int64) (map[int64]map[string]string, error)
|
||||
if !rf.Worked {
|
||||
continue
|
||||
}
|
||||
// DXCC's ref is a number → show the country name instead.
|
||||
// Per-award display choice: ref (default), name (description), or
|
||||
// both. DXCC keeps showing the country name under the default.
|
||||
label := rf.Ref
|
||||
if dxccField && rf.Name != "" {
|
||||
label = rf.Name
|
||||
switch dispByCode[code] {
|
||||
case "name":
|
||||
if rf.Name != "" {
|
||||
label = rf.Name
|
||||
}
|
||||
case "both":
|
||||
if rf.Name != "" {
|
||||
label = rf.Ref + " — " + rf.Name
|
||||
}
|
||||
default: // "" or "ref"
|
||||
if dxccField && rf.Name != "" {
|
||||
label = rf.Name
|
||||
}
|
||||
}
|
||||
refs = append(refs, label)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user