Commit d86b61fe authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE

speed up is_mapping_done

parent 56c40f76
......@@ -21,6 +21,12 @@ class GlobalViralHostResponseValue(models.Model):
verbose_name = _("Global Viral-Host response values")
verbose_name_plural = _("Global Viral-Host response values")
index_together = [
["id", "name"],
["id", "value"],
["id", "name", "value"],
]
permissions = (
("change_globalviralhostresponsevalue_color", "Can change Global Viral-Host response color"),
)
......@@ -227,9 +233,8 @@ class DataSource(models.Model):
@property
def is_mapping_done(self):
return not GlobalViralHostResponseValue.objects \
.filter(responseindatasource__data_source__pk=self.pk) \
.filter(name=GlobalViralHostResponseValue.get_not_mapped_yet_keyword()) \
return not ViralHostResponseValueInDataSource.objects \
.filter(data_source__pk=self.pk, response__name=GlobalViralHostResponseValue.get_not_mapped_yet_keyword()) \
.exists()
@property
......
Markdown is supported
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