diff --git a/backend/apps/api/v1/admin.py b/backend/apps/api/v1/admin.py index 693fd77c..a440a65a 100644 --- a/backend/apps/api/v1/admin.py +++ b/backend/apps/api/v1/admin.py @@ -612,6 +612,7 @@ class DatasetAdmin(OrderedInlineModelAdminMixin, TabbedTranslationAdmin): "contains_tables", "contains_raw_data_sources", "contains_information_requests", + "contains_closed_data", "page_views", "created_at", "updated_at", diff --git a/backend/apps/api/v1/migrations/0051_remove_dataset_is_closed.py b/backend/apps/api/v1/migrations/0051_remove_dataset_is_closed.py new file mode 100644 index 00000000..2012247a --- /dev/null +++ b/backend/apps/api/v1/migrations/0051_remove_dataset_is_closed.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.16 on 2024-11-07 12:24 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('v1', '0050_table_is_deprecated'), + ] + + operations = [ + migrations.RemoveField( + model_name='dataset', + name='is_closed', + ), + ] diff --git a/backend/apps/api/v1/models.py b/backend/apps/api/v1/models.py index c3233ddf..887e93b0 100644 --- a/backend/apps/api/v1/models.py +++ b/backend/apps/api/v1/models.py @@ -538,9 +538,6 @@ class Dataset(BaseModel): ) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) - is_closed = models.BooleanField( - default=False, help_text="Dataset is for BD Pro subscribers only" - ) page_views = models.BigIntegerField( default=0, help_text="Number of page views by Google Analytics", @@ -662,14 +659,22 @@ def contains_closed_data(self): closed_data = False tables = self.tables.all() for table in tables: + # Check for closed coverages table_coverages = table.coverages.filter(is_closed=True) if table_coverages: closed_data = True break + + # Check for closed columns for column in table.columns.all(): if column.is_closed: # in the future it will be column.coverages closed_data = True break + + # Check if uncompressed file size is above 1 GB + if table.uncompressed_file_size and table.uncompressed_file_size > 1000000000: + closed_data = True + break return closed_data