Far better QSO crosschecking
This commit is contained in:
parent
f960f6919d
commit
a79269c65d
|
@ -148,7 +148,7 @@ class QSO(models.Model):
|
|||
|
||||
cfmdQSO = models.ForeignKey("QSO", models.SET_NULL, null=True, blank=True, default=None)
|
||||
|
||||
CFMD_SEC = 300
|
||||
CFMD_SEC = 5*60
|
||||
|
||||
def checkQSOData(self):
|
||||
""" Match strdata to log rows. Only call, if you intent to save this object if we return True! """
|
||||
|
@ -182,8 +182,9 @@ class QSO(models.Model):
|
|||
if self.cfmdQSO:
|
||||
# check if this still checks out
|
||||
q = self.cfmdQSO
|
||||
if (self.time - q.time).total_seconds() <= self.CFMD_SEC and \
|
||||
self.ref and self.owner.ref and \
|
||||
if abs((self.time - q.time).total_seconds()) <= self.CFMD_SEC and \
|
||||
self.ref and self.owner.ref and self.callRef and q.callRef and \
|
||||
q.owner == self.callRef and q.callRef == self.owner and \
|
||||
self.ref == q.owner.ref and self.owner.ref == q.ref and \
|
||||
self.band == q.band:
|
||||
# checks out
|
||||
|
@ -191,12 +192,15 @@ class QSO(models.Model):
|
|||
else:
|
||||
changed = True
|
||||
self.cfmdQSO.cfmdQSO = None
|
||||
self.cfmdQSO.save(checkQSO=False)
|
||||
self.cfmdQSO = None
|
||||
|
||||
if self.ref and self.callRef and self.callRef.ref and not self.cfmdQSO:
|
||||
# look for a matching line
|
||||
q = QSO.objects.filter(
|
||||
(Q(time__gte=self.time + datetime.timedelta(0, self.CFMD_SEC)) | Q(time__gte=self.time - datetime.timedelta(0, self.CFMD_SEC))),
|
||||
(Q(time__lte=self.time + datetime.timedelta(seconds=self.CFMD_SEC)) & Q(time__gte=self.time - datetime.timedelta(seconds=self.CFMD_SEC))),
|
||||
owner=self.callRef,
|
||||
callRef=self.owner,
|
||||
owner__ref=self.ref,
|
||||
ref=self.owner.ref,
|
||||
band=self.band)
|
||||
|
|
Loading…
Reference in New Issue