# HG changeset patch # User Josef 'Jeff' Sipek # Date 1721391467 14400 # Fri Jul 19 08:17:47 2024 -0400 # Node ID 973dfb8d4969c733bb5a55da739d9643c91dfaff # Parent 58cb42a7cce96e1fc15cc1833b17f0f2cce0ffe3 xlua: load existing CQ-WW-VHF contacts on startup This way, restarting the logger still results in correct dup checking. Signed-off-by: Josef 'Jeff' Sipek diff --git a/xlua/scripts/contests/CQ-WW-VHF.lua b/xlua/scripts/contests/CQ-WW-VHF.lua --- a/xlua/scripts/contests/CQ-WW-VHF.lua +++ b/xlua/scripts/contests/CQ-WW-VHF.lua @@ -1,5 +1,5 @@ -- --- Copyright (c) 2022 Josef 'Jeff' Sipek +-- Copyright (c) 2022,2024 Josef 'Jeff' Sipek -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal @@ -65,14 +65,7 @@ return 1 -- no prefix found ==> not dup end -local function qso_done(qso) - if not ALLOWED_BANDS[qso.tx.band] then - return -- ignore out-of-band contacts - end - - qso.additional['contest-id'] = 'CQ-WW-VHF' - qso.additional['contest-year'] = contest.year - +local function update_dup_table(qso) local where = hash(qso.tx.grid, qso.rx.grid) local mult = string.format("%u-%s", qso.tx.band, where) @@ -84,6 +77,17 @@ mults[mult] = true end +local function qso_done(qso) + if not ALLOWED_BANDS[qso.tx.band] then + return -- ignore out-of-band contacts + end + + qso.additional['contest-id'] = 'CQ-WW-VHF' + qso.additional['contest-year'] = contest.year + + update_dup_table(qso) +end + -- -- Annunciator color -- @@ -161,6 +165,14 @@ }, events = { + startup = function() + for qso in hlog.index.history(true) do + if qso.additional['contest-id'] == 'CQ-WW-VHF' and + qso.additional['contest-year'] == contest.year then + update_dup_table(qso) + end + end + end, qso_init = function(qso) contest.lcd(mkgrid(qso.tx.grid)) end,