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