-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rescore upon reading the log #292
Conversation
Yes, that step was obvious. If you compare old code in readcalls() and the code in addcall() carefully you will find some subtle differences in handling of corner cases like arrl contests for the w/ve side. I was not quite sure which behavior is the right one, so I hesitated from the simple change before understanding all implications. But lets go on.
I think it can be made simple (but not without some changes). Let us keep the parsed records ('struct qso_t') and add them to a ptr array. That array would be a complete internal representation of all qsos and comments. Than we can reconstruct the display line from the record when needed for display. That way it will always be up to date. As an additional side effect it enables us later to generate the display line in different width (and detail) as soon as we support a variable display width in xterm Both ideas were the main reason to introduce the 'struct qso'. To keep it simple I just started in spring with only the struct and left out the collection of all structs in the array for later. As a sidenote, let me ask to keep the commits a little more clean. Having the unrelated changes for station info or scoring in the same commit makes it harder in the review to focus on the real core of the commit. |
re station info: it had to be moved before reading the log (country has to be known) and since it used plain printw's it got partially obscured by readcalls' output (via showmsg with its internal line number tracking), hence the rework. |
Oh, thanks. I missed that point. |
|
||
total = 0; | ||
nr_qsolines = readcalls(logfile); | ||
if (qtcdirection > 0) { | ||
readqtccalls(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On startup readqtccalls()
is called before readcalls()
. Hopefully the order is not relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure. That needs to be checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See issue #310
test/test_readcalls.c
Outdated
|
||
// dummy functions | ||
void readqtccalls() {} | ||
void shownr(char *msg, int x) {} | ||
void spaces(int n) {} /* needs more care */ | ||
const char *spaces(int n) { return "";} /* needs more care */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dummies for getexchange
...
Will add (probably next week) updating the in-memory log using |
Fixed (or at least improved) WPX rescoring. For this the |
|
||
init_scoring(); | ||
|
||
if ((fp = fopen(logfile, "r")) == NULL) { | ||
showmsg("Error opening logfile "); | ||
refreshp(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already done in showmsg()
Log lines are re-created using Next |
I did some checks for that variable and tried to make some comments about its working - see dl1jbe@842feaf |
I will try to check the handling in the existing code and compare with older versions. Maybe we can sort it out. |
bool log_changed = false; | ||
// array of qso's | ||
// FIXME use this instead of qsos[] (make it global and don't free it here) | ||
// FIXME also include comments/notes into qso_t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just add a 'iscomment' flag and a pointer to the comment string or save some memory by using a union union from the actual qso_t and the comment field pointer.
Ideally scoring and mult handling shall be independent of whether the QSO originated locally, received from network or read from a file. Therefore any veto logic have to be an internal detail of the processing. |
We are on the way to it. |
comment[4] = 'X'; | ||
comment[5] = '\0'; | ||
char buf[80]; | ||
strcpy(buf, qso->comment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change a private copy of comment.
Unless there are issues to fix this is it for the moment. I'd let it get used to see if other problems pop up. |
Let me know if you see something open here. If there are none then I'd merge this and also close #248. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides the question about 'freq' if no rig control is active I think all should be well.
Please double check and feel free to merge it in afterwards.
|
||
/* add points to logline if in contest */ | ||
if (iscontest && !CONTEST_IS(DXPED)) { | ||
sprintf(logline4 + 76, "%2d", qso_points); | ||
sprintf(logline + 76, "%2d", qso_points); //FIXME qso->score |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should keep ALL information for the qso after evaluating it with addcall/addmult.
Question is - should we just extend qso_t or use the parsed data as part of another struct which provides the additional data (points, zone, cty, ...)
if (trx_control) { | ||
snprintf(freq_buff, 8, "%7.1f", freq / 1000.0); | ||
strcat(logline4, freq_buff); | ||
if (qso->freq > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone use TLF without radio control is freq then set to 0.?
At the moment we do not record a frequency in these case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trx_control
tells whether rig control is currently in use, whereas qso->freq > 0
checks if freq was known at the time of the QSO. Generally this could have been earlier or even currently but on another Tlf node. So relying on trx_control
is not correct.
If trx control is disabled while Tlf is running then freq
is not set to zero (previous value is kept). Similarly if trx control is enabled then rig connection is not initialized, freq stays zero. IMO both are bugs.
addcall(qso); | ||
score_qso(); //FIXME argument? | ||
|
||
char *logline = makelogline(qso); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After finishing all migration away from qsos[], we do not need to record such things as points, multis or prefixes in the written log.
The we could drop these check for a change of logfile. The file would be the same as long as we do not change some of the qso information (time, call, exchange, band...).
But that leads us again to a discussion of logfile format. We should keep that for later.
src/readcalls.c
Outdated
char *backup = g_strdup_printf("%s_%s", prefix, logfile); | ||
rename(logfile, backup); | ||
// rewrite log | ||
remove(logfile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no 'logfile' after the rename.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Am Tue, 04 Jan 2022 07:01:50 -0800
schrieb Zoltan Csahok ***@***.***>:
@zcsahok commented on this pull request.
>
/* add freq to end of logline */
- if (trx_control) {
`trx_control` tells whether rig control is currently in use, whereas
`qso->freq > 0` checks if freq was known at the time of the QSO.
Generally this could have been earlier or even currently but on
another Tlf node. So relying on `trx_control` is not correct.
Ok, I overlooked the situation wrt other tlf nodes which may report the
frequency-
If trx control is disabled while Tlf is running then `freq` is not
set to zero (previous value is kept). Similarly if trx control is
enabled then rig connection is not initialized, freq stays zero. IMO
both are bugs.
Right. Enabling trx_control should try to initialize the rig
connection. Needs to be done. Both bugs should be fixed. Will put it on
todo list.
…--
"Do what is needful!"
Ursula LeGuin: Earthsea
--
|
Too simple to be true. :-) But let's see.
Here is an example: in the OK-OM contest I didn't set ONE_POINT, so all QSOs were scored with zero points. Mults were configured correctly, so that part is fine.

Added the missing ONE_POINT to the rule file and restarted Tlf: now I've 39 points for the 39 QSOs.

All QSOs were on 80, so as a test I moved the one with section MYJ to 40. I worked MYJ on 80 before, so the net result is that I "earn" it as a new one on 40. This operation was done from within Tlf using :EDIt, no restart was required.

As discussed in #248 the log itself is not updated (currently neither on disk nor in memory), hence the lines still show 0 points in the screenshots above. This could be seen as bug, but the fix must be discussed.