feat(awards): a reference's number can be corrected in the editor
The one field the editor would not let you touch, and the one that was wrong on WAJA. Every other property of a reference — its name, pattern, entity list, validity window — was editable; the code was rendered readOnly, so correcting a number meant deleting all 47 references and importing a new list, throwing away anything the operator had adjusted in it. A rename in the store, not a delete plus an insert: everything the reference carries travels with it, which is the whole point of correcting a number rather than replacing an entry. A number already in use is refused — REPLACE INTO would have let one reference silently swallow another, discovered much later as a prefecture quietly missing from the list. The typed code is held apart from the selection. The list and every field patch key off the selected code, so editing it in place made the editor lose the reference mid-edit. SaveAwardReference now recomputes the log like Delete and Replace already did. A reference's name is what the award column SHOWS for awards displaying by name, and its pattern is part of what matches at all — so editing one changes rows, and the grid was left showing the old label until something else happened to trigger a pass. Changelog: the three TCI-sharing lines are merged into one. The server and the two fixes made to it while building are one unreleased feature, and an operator only ever meets the finished thing. The TCI-client PTT line stays separate — it is OpsLog driving a SunSDR, the other direction entirely.
This commit is contained in:
@@ -5240,6 +5240,37 @@ func (a *App) SaveAwardReference(code string, ref awardref.Ref) error {
|
||||
}
|
||||
a.markAwardEdited(code)
|
||||
a.mirrorAwards()
|
||||
// A reference's name is what the award column SHOWS for awards displaying by
|
||||
// name, and its pattern is part of what matches at all — so editing one
|
||||
// changes rows in the log, exactly as deleting or replacing the list does.
|
||||
// Those already recomputed; this did not, and left the grid showing the old
|
||||
// label until something else happened to trigger a pass.
|
||||
a.recomputeAwardRefsAsync()
|
||||
return nil
|
||||
}
|
||||
|
||||
// RenameAwardReference changes a reference's code on an award the operator
|
||||
// already runs.
|
||||
//
|
||||
// The one field the editor could not touch, and the one that was wrong: WAJA
|
||||
// shipped numbered by the Japanese state rather than by the JARL. Correcting it
|
||||
// meant deleting the whole list and importing another — throwing away anything
|
||||
// the operator had adjusted in it.
|
||||
func (a *App) RenameAwardReference(code, oldRef, newRef string) error {
|
||||
if a.awardRefs == nil {
|
||||
return fmt.Errorf("db not initialized")
|
||||
}
|
||||
if err := a.awardRefs.Rename(a.ctx, code, oldRef, newRef); err != nil {
|
||||
return err
|
||||
}
|
||||
a.markAwardEdited(code)
|
||||
a.mirrorAwards()
|
||||
// The materialised award columns hold a LABEL computed from the definition —
|
||||
// the reference code for most awards, the name for those displaying by name.
|
||||
// A renumbered reference changes the first kind, so the log is recomputed
|
||||
// exactly as it is for every other reference-list change.
|
||||
a.recomputeAwardRefsAsync()
|
||||
applog.Printf("awards: %s reference %s renumbered to %s", code, oldRef, newRef)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user