Skip to content

Commit

Permalink
fix #761
Browse files Browse the repository at this point in the history
restored the CCD-accept fsLog entries; enhance fsGetPrevSeq to skip CCD entries
  • Loading branch information
caver456 committed Sep 13, 2024
1 parent 113794b commit c00e3f0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions radiolog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2452,7 +2452,7 @@ def fsParse(self):
prevSeq=self.fsGetPrevSeq(fleet,dev)
elif uid:
prevSeq=self.fsGetPrevSeq(uid)
# rprint('prevSeq:'+str(prevSeq))
rprint('prevSeq:'+str(prevSeq))
attemptNEW=False
if 'BOT' in seq:
attemptNEW=True
Expand Down Expand Up @@ -2972,17 +2972,21 @@ def fsGetPrevSeq(self,fleetOrUid,dev=None):
rprint('ERROR in call to getPrevSeq: dev is not a string.')
return []

# ignore rows whose sequence is 'CCD'; could get costly as number of fullLog entries increases;
# make sure to efficiently walk the list backwards, rather than looking through the whole list every time
prevSeq=None
if len(fleetOrUid)==3: # 3 characters - must be fleetsync
fleet=fleetOrUid
for row in self.fsLog:
if row[0]==fleet and row[1]==dev:
for i in range(len(self.fsFullLog)-1,-1,-1):
row=self.fsFullLog[i]
if row[0]==fleet and row[1]==dev and row[8]!=['CCD']:
prevSeq=row[8]
break
elif len(fleetOrUid)==5: # 5 characters - must be NEXEDGE
uid=fleetOrUid
for row in self.fsLog:
if row[1]==uid:
for i in range(len(self.fsFullLog)-1,-1,-1):
row=self.fsFullLog[i]
if row[1]==uid and row[8]!=['CCD']:
prevSeq=row[8]
break
return prevSeq or [] # don't return None or False - must return a list
Expand Down Expand Up @@ -9598,14 +9602,12 @@ def accept(self):
self.parent.parent.fsSaveLookup()
# change the callsign in fsLog
if id2: # fleetsync
#761 - don't call fsLogUpdate here as doing so would break the sequence logic
# rprint('calling fsLogUpdate for fleetsync')
# self.parent.parent.fsLogUpdate(fleet=fleet,dev=dev,callsign=newCallsign,seq=['CCD'],result='newCallsign')
self.parent.parent.fsLogUpdate(fleet=fleet,dev=dev,callsign=newCallsign,seq=['CCD'],result='newCallsign')
rprint("New callsign pairing created from FleetSync: fleet="+fleet+" dev="+dev+" callsign="+newCallsign)
else: # nexedge
#761 - don't call fsLogUpdate here as doing so would break the sequence logic
# rprint('calling fsLogUpdate for nexedge')
# self.parent.parent.fsLogUpdate(uid=uid,callsign=newCallsign,seq=['CCD'],result='newCallsign')
self.parent.parent.fsLogUpdate(uid=uid,callsign=newCallsign,seq=['CCD'],result='newCallsign')
rprint("New callsign pairing created from NEXEDGE: unit ID = "+uid+" callsign="+newCallsign)
# finally, pass the 'accept' signal on up the tree as usual
# set the focus to the messageField of the active stack item - not always
Expand Down

0 comments on commit c00e3f0

Please sign in to comment.