Commit 9691b257 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

fix caching of PK tests available property for Compound

FIX #229
parent ea7d889d
......@@ -13,7 +13,7 @@ from django.contrib.auth import get_user_model
from django.core.exceptions import ValidationError
from django.db import models, transaction
from django.db.models import FloatField, IntegerField, BooleanField
from django.db.models import Max, Count, F, Q, Case, When, Subquery, OuterRef
from django.db.models import Max, Count, F, Q, Case, When, Subquery, OuterRef, Exists
from django.db.models.functions import Cast
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
......@@ -1814,10 +1814,8 @@ def update_compound_cached_properties(compounds_queryset=None):
)
.values("_bindtest_av")[:1]
),
pktest_av=Subquery(
compounds_queryset.filter(id=OuterRef("id"))
.annotate(_pktest_av=Count("compoundpkresult", distinct=True))
.values("_pktest_av")[:1]
pktest_av=Exists(
CompoundPKResult.objects.filter(id=OuterRef("id"))
),
cytoxtest_av=Subquery(
compounds_queryset.filter(id=OuterRef("id"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment