diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index b510423fa334708310c3b879dec4fb922de2468c..15dde95a56ba92601f7a703f346efd34b97e8589 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -1038,9 +1038,7 @@ class TestActivityDescription(models.Model): nb_active_compounds = models.IntegerField( verbose_name="Total number of active compounds" ) - cell_line = models.ForeignKey( - CellLine, on_delete=models.SET_NULL, null=True - ) + cell_line = models.ForeignKey(CellLine, on_delete=models.SET_NULL, null=True) def get_complexes(self): """ @@ -1326,7 +1324,12 @@ def update_compound_cached_properties(compounds_queryset=None): ), best_activity=Subquery( compounds_queryset.filter(id=OuterRef("id")) - .annotate(_best_activity=Max("compoundactivityresult__activity")) + .annotate( + _best_activity=Max( + "compoundactivityresult__activity", + filter=~Q(compoundactivityresult__activity_type="KdRat"), + ) + ) .values("_best_activity")[:1] ), le=Subquery(