feat(log): QSO number column, oldest contact = 1
Not the id: the primary key follows insertion order, so importing an old ADIF gives the oldest contacts the highest ids. This is a rank over qso_date. Computed over the WHOLE log, not the query result — ranking inside the result would renumber every contact the moment a filter is applied, and QSO #1 would change identity as the operator typed. Held as one id-to-rank map, built from a single ordered id query and dropped with the other derived indexes when the log changes. A contact logged from the entry form is the newest, so it takes the next number without rereading the log: AddQSO deliberately avoids full invalidation because a contest run would pay for it once per QSO. A contact entered with an OLDER date belongs in the middle of the order, so there the map is dropped and rebuilt rather than mis-numbered.
This commit is contained in:
@@ -132,6 +132,10 @@ function qsoDistanceKm(d: any, myGrid?: string): number | undefined {
|
||||
|
||||
export const makeColCatalog = (t: TFn, myGrid?: string): ColEntry[] => [
|
||||
// ── QSO basics ──
|
||||
// Position in the log, oldest = 1. Filled by the backend over the WHOLE log,
|
||||
// so it does not change when a filter narrows what is shown.
|
||||
{ group: 'QSO', label: t('rqg.c.number'), colId: 'number', headerName: t('rqg.h.number'), field: 'number' as any, width: 80, type: 'rightAligned', cellClass: 'font-mono',
|
||||
comparator: (a, b) => (a ?? 0) - (b ?? 0) },
|
||||
{ group: 'QSO', label: t('rqg.c.qso_date'), colId: 'qso_date', headerName: t('rqg.c.qso_date'), field: 'qso_date' as any, width: 150, cellClass: 'font-mono', valueFormatter: (p) => fmtDateUTC(p.value), sort: 'desc', defaultVisible: true },
|
||||
{ group: 'QSO', label: t('rqg.c.qso_date_off'), colId: 'qso_date_off', headerName: t('rqg.c.qso_date_off'), field: 'qso_date_off' as any, width: 150, cellClass: 'font-mono', valueFormatter: (p) => fmtDateUTC(p.value) },
|
||||
{ group: 'QSO', label: t('rqg.c.callsign'), colId: 'callsign', headerName: t('rqg.c.callsign'), field: 'callsign' as any, width: 110, cellClass: 'font-mono font-semibold', defaultVisible: true },
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4206,6 +4206,7 @@ export namespace qso {
|
||||
}
|
||||
export class QSO {
|
||||
id: number;
|
||||
number?: number;
|
||||
callsign: string;
|
||||
// Go type: time
|
||||
qso_date: any;
|
||||
@@ -4346,6 +4347,7 @@ export namespace qso {
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) source = JSON.parse(source);
|
||||
this.id = source["id"];
|
||||
this.number = source["number"];
|
||||
this.callsign = source["callsign"];
|
||||
this.qso_date = this.convertValues(source["qso_date"], null);
|
||||
this.qso_date_off = this.convertValues(source["qso_date_off"], null);
|
||||
|
||||
Reference in New Issue
Block a user