Closed KKruszynska closed 1 month ago
Reviewing the query code that selects events for this view, I think the exclude was implemented wrong.
Previously the query was doing:
ts = Target.objects.filter(
tap_priority__gt=threshold,
sky_location__icontains='Outside HCZ',
classification__icontains='Microlensing)
.exclude(
YSO=True,
QSO=True,
galaxy=True,
alive=False
)
But this chaining of filters is interpreted as an AND, but in practice we actually want an OR for the exclude filters. So I've updated this code to use the Q operator:
ts = Target.objects.filter(
Q(tap_priority__gt=priority_threshold)
& Q(sky_location__icontains='Outside HCZ')
& Q(classification__icontains='Microlensing')
).exclude(
Q(YSO=True) | Q(QSO=True) | Q(galaxy=True) | Q(alive=False)
)
Targets that are not Alive seem to be appearing in the Priority Target view. See: https://mop.lco.global/targets/3700/ And: