Commit 1f5000d8 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

reverse partially 9859f3af: tests_av is actually an int

WIP on #229
parent 9859f3af
Pipeline #33813 passed with stages
in 17 minutes and 6 seconds
......@@ -1495,14 +1495,21 @@ class ContributionManager(models.Manager):
if current_user.is_anonymous:
qs = qs.exclude(validated=False)
elif not current_user.is_superuser:
qs = qs.exclude(Q(validated=False), ~Q(contributor=current_user),)
qs = qs.exclude(
Q(validated=False),
~Q(contributor=current_user),
)
return qs
def validated(self):
"""
Get validated contributions
"""
return super().get_queryset().exclude(validated=False)
return (
super()
.get_queryset()
.exclude(validated=False)
)
class Contribution(models.Model):
......@@ -1807,7 +1814,9 @@ def update_compound_cached_properties(compounds_queryset=None):
)
.values("_bindtest_av")[:1]
),
pktest_av=Exists(CompoundPKResult.objects.filter(id=OuterRef("id"))),
pktest_av=Exists(
CompoundPKResult.objects.filter(id=OuterRef("id"))
),
cytoxtest_av=Exists(
CompoundCytotoxicityResult.objects.filter(id=OuterRef("id"))
),
......@@ -1829,7 +1838,11 @@ def update_compound_cached_properties(compounds_queryset=None):
)
.values("_insilico_av")[:1]
),
tests_av=Exists(CompoundActivityResult.objects.filter(id=OuterRef("id"))),
tests_av=Subquery(
compounds_queryset.filter(id=OuterRef("id"))
.annotate(_tests_av=Count("compoundactivityresult", distinct=True))
.values("_tests_av")[:1]
),
)
compounds_queryset.update(
best_activity_ppi_family_name=Subquery(
......
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