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)
|
cfmdQSO = models.ForeignKey("QSO", models.SET_NULL, null=True, blank=True, default=None)
|
||||||
|
|
||||||
CFMD_SEC = 300
|
CFMD_SEC = 5*60
|
||||||
|
|
||||||
def checkQSOData(self):
|
def checkQSOData(self):
|
||||||
""" Match strdata to log rows. Only call, if you intent to save this object if we return True! """
|
""" 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:
|
if self.cfmdQSO:
|
||||||
# check if this still checks out
|
# check if this still checks out
|
||||||
q = self.cfmdQSO
|
q = self.cfmdQSO
|
||||||
if (self.time - q.time).total_seconds() <= self.CFMD_SEC and \
|
if abs((self.time - q.time).total_seconds()) <= self.CFMD_SEC and \
|
||||||
self.ref and self.owner.ref 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.ref == q.owner.ref and self.owner.ref == q.ref and \
|
||||||
self.band == q.band:
|
self.band == q.band:
|
||||||
# checks out
|
# checks out
|
||||||
|
@ -191,12 +192,15 @@ class QSO(models.Model):
|
||||||
else:
|
else:
|
||||||
changed = True
|
changed = True
|
||||||
self.cfmdQSO.cfmdQSO = None
|
self.cfmdQSO.cfmdQSO = None
|
||||||
|
self.cfmdQSO.save(checkQSO=False)
|
||||||
self.cfmdQSO = None
|
self.cfmdQSO = None
|
||||||
|
|
||||||
if self.ref and self.callRef and self.callRef.ref and not self.cfmdQSO:
|
if self.ref and self.callRef and self.callRef.ref and not self.cfmdQSO:
|
||||||
# look for a matching line
|
# look for a matching line
|
||||||
q = QSO.objects.filter(
|
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,
|
owner__ref=self.ref,
|
||||||
ref=self.owner.ref,
|
ref=self.owner.ref,
|
||||||
band=self.band)
|
band=self.band)
|
||||||
|
|
Loading…
Reference in New Issue