From b8e79d8f8f4de979b2d1467aeaa9eeff580149ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20M=C3=A9nager?= <herve.menager@pasteur.fr> Date: Mon, 27 Apr 2020 21:15:03 +0200 Subject: [PATCH] make sure that unreferenced compounds are not mistaken as validated FIX #216 --- ippisite/ippidb/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index b8e50429..8f233f86 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -895,6 +895,11 @@ class Compound(AutoFillableModel): return self.drugbankcompoundtanimoto_set.order_by("-tanimoto") def is_validated(self): + # if compound is not linked to any CompoundAction this is + # because it was dereferenced because of duplication by + # `replace_compound_references` + if self.compoundaction_set.count()==0: + return False for ca in self.compoundaction_set.all(): if ca.ppi.contribution_set.filter(validated=False).exists(): return False -- GitLab