Skip to content

Commit

Permalink
-> get_data_versions restored (??)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-paquette committed Jan 8, 2025
1 parent b61bab2 commit 50bb4af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cohorts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ def get_export_is_valid(self):
return None
return (self.last_exported_date+datetime.timedelta(days=settings.BIGQUERY_USER_MANIFEST_TIMEOUT)) > datetime.datetime.utcnow().replace(tzinfo=pytz.utc)

# Returns the data versions identified in the filter groups for this cohort
# Returns a DataVersion QuerySet
def get_data_versions(self, active=None):
data_versions = CgcDataVersion.objects.filter(id__in=self.filter_group_set.all().values_list('data_version',flat=True)) \
if active is None else CgcDataVersion.objects.filter(active=active, id__in=self.filter_group_set.all().values_list('data_version',flat=True))

return data_versions.distinct()

def only_active_versions(self):
return bool(len(self.get_data_versions(active=False)) <= 0)

Expand Down

0 comments on commit 50bb4af

Please sign in to comment.