feat(bulk): My DXCC / My CQ zone / My ITU zone
The My-station group covered nineteen fields and not the three numeric ones. They take their own integer path rather than the generic text setter: the columns are nullable integers, and while SQLite would coerce '14' quietly, a shared MySQL logbook would not — and empty must become NULL, never ''. Bounds checked (DXCC <1000, CQ 1-40, ITU 1-90) so a slip cannot stamp zone 400 across a thousand rows.
This commit is contained in:
@@ -6938,6 +6938,28 @@ func (a *App) BulkUpdateField(ids []int64, field, value string) (int64, error) {
|
||||
if field == "freq" {
|
||||
return a.bulkSetFrequency(ids, value)
|
||||
}
|
||||
// The station-side numbers. Bounded so a slip cannot stamp CQ zone 400 on a
|
||||
// thousand rows: DXCC entities stop short of 1000, CQ zones at 40, ITU at 90.
|
||||
// Empty clears (NULL).
|
||||
if field == "my_dxcc" || field == "my_cq_zone" || field == "my_itu_zone" {
|
||||
var vp *int
|
||||
if t := strings.TrimSpace(value); t != "" {
|
||||
v, err := strconv.Atoi(t)
|
||||
max := map[string]int{"my_dxcc": 999, "my_cq_zone": 40, "my_itu_zone": 90}[field]
|
||||
if err != nil || v < 1 || v > max {
|
||||
return 0, fmt.Errorf("%s must be a number between 1 and %d (empty to clear)", field, max)
|
||||
}
|
||||
vp = &v
|
||||
}
|
||||
n, err := a.qso.BulkSetIntField(a.ctx, ids, field, vp)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if n > 0 {
|
||||
a.invalidateAwardStats()
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
// Some ADIF fields have no promoted column and live in extras_json
|
||||
// (OWNER_CALLSIGN) — those take the JSON path so the rest of the extras on
|
||||
// each QSO survive the edit.
|
||||
|
||||
Reference in New Issue
Block a user